The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

shadowColor property

Gets or sets the color to use for shadows.

This property is read/write.

HTML Canvas 2D Context, Section 7Internet Explorer 9



object.shadowColor = color

color = object.shadowColor

Property values

Type: string

The CSS color.

Standards information


Any values of the p parameter that are not CSS colors are ignored.


The following code example draws a series of squares that have different colors for shadowColor.

  <script type="text/javascript">
      function draw() {
          var canvas = document.getElementById("MyCanvas");
          if (canvas.getContext) {
              var ctx = canvas.getContext("2d");
              // Define the shadow parameters.
              ctx.shadowColor = "black";
              ctx.shadowBlur = "5";
              ctx.shadowOffsetX = "5";
              ctx.shadowOffsetY = "5";
              ctx.strokeRect(25, 25, 200, 200);
              ctx.shadowColor = "red";
              ctx.strokeRect(75, 75, 200, 200);
              ctx.shadowColor = "green";
              ctx.strokeRect(125, 125, 200, 200);
              ctx.shadowColor = "blue";
              ctx.strokeRect(175, 175, 200, 200);
              ctx.shadowColor = "purple";
              ctx.strokeRect(225, 225, 200, 200);
<body onload="draw();">
  <canvas id="MyCanvas" width="600" height="500">This browser or document mode doesn't support canvas</canvas> 

See also




© 2014 Microsoft. All rights reserved.