Colors are used to fill colors in shapes by using some properties such as fillStyle and strokeStyle. fillStyle property is used to fill color in shapes and strokeStyple property is used to fill outline color of shape. There are few types of color that are used to apply to shapes. The color types include color name, RGB (red green blue), Hex values, rgba (red green blue alpha).
var variableName = canvas.getContext(2d);
variableName.fillStyle="colorName/rgb()/hex values";
You can apply color properties to any shape.
Open notepad or any other text editor, follow the following points.
save file with name task.html or task.htm and then open it using any browser and see results.