Advertisement
Home Open Editor ❯

HTML canvas shadowColor Property

Example

// Accessing the element
let c = document.getElementById("myCanvas");

// Styling canvas
let ctx = c.getContext("2d");
ctx.shadowBlur = 10;
ctx.shadowColor = "black";
ctx.fillStyle = "red";
ctx.fillRect(25, 25, 100, 100);

Try this code ❯

Meaning

The shadowColor canvas property sets or returns the color to use for shadows.


Standard Syntax

Default value:

#000000

JavaScript syntax:

context.shadowColor=color;


Advertisement

Property Values

Value Description
color Specifies the CSS color value to use for shadows. Default value is #000000.
Home Open Editor ❯
Advertisement