HTML canvas shadowColor attribute
Example
Draw a red rectangle with a black shadow:
JavaScript:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.shadowBlur=20;
ctx.shadowColor="black";
ctx.fillStyle="red";
ctx.fillRect(20,20,100,80);
Try it »
Browser support





Internet Explorer 9, Firefox, Opera, Chrome and Safari support the shadowColor attribute.
**Note:** Internet Explorer 8 and earlier versions do not support
Definition and Usage
The shadowColor attribute sets or returns the color used for the shadow.
**Note:** Use the shadowColor attribute together with the shadowBlur attribute to create a shadow.
**Tip:** Please use the shadowOffsetX and shadowOffsetY attribute to adjust the shadow effect.
| Default value: | #000000 |
|---|---|
| JavaScript syntax: | context.shadowColor=color; |
Attribute values
| Value | Description |
|---|---|
| color | used for the shadow A CSS color value. The default value is #000000. |
Canvas object