Canvas shadowColor property

Definition and usage

shadowColor property.

Note:Please set or return the color used for the shadow by using the property to create a shadow. property together with the

Tip:Please use the shadowOffsetX and shadowOffsetY Use this property to adjust the shadow effect.

Example

Draw a blue rectangle with a black shadow:

Your browser does not support the canvas tag.

JavaScript:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.shadowBlur=20;
ctx.shadowColor="black";
ctx.fillStyle="blue";
ctx.fillRect(20,20,100,80);

Try it yourself

Syntax

context.shadowColor=color;

Property value

Value Description
color For shadows CSS color value.The default value is #000000.

Technical details

Default value: #000000

Browser support

The numbers in the table indicate the first browser version that fully supports this property.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
4.0 9.0 3.6 4.0 10.1

Note:Internet Explorer 8 and earlier versions do not support the <canvas> element.