The shadowColor property

[No canvas support]
An example of the shadowColor property

This sets the color of the shadow. The color must be a valid CSS color (ie gradients and patterns are not permitted here but you can use RGBA colors or RGB colors such as: rgba(255,0,0,0.5) rgb(255,0,0) ).

The example to the right sets the shadow color to a solid green color.

An example

    window.onload = function ()
        var canvas  = document.getElementById("cvs");
        var context = canvas.getContext('2d');

        var x       = 50;
        var y       = 50;
        var width   = 100;
        var height  = 100;
        context.shadowColor = 'green';
        context.shadowOffsetX = 3;
        context.shadowOffsetY = 3;
        context.shadowBlur = 15;
        context.fillStyle = 'red';    
        context.fillRect(x, y, width, height);

See also

RGraph on social media