USING SOLID COLOR ON THE CANVAS
You can customize what color is used when drawing on the canvas. Earlier sections of this chapter have shown shapes, paths, and text drawn in black, which is the default if the fillStyle and strokeStyle attributes are undefined.
context.fillStyle = 'color';context.strokeStyle = 'color';
The color value can be one of four string formats:
- #RRGGBB — Specifies an RGB color in three pairs of hexadecimal numbers, from 00 for no color to FF for maximum color, depending on position. For example, #FF8000 is maximum red, half green, and no blue, which appears orange.
- rgb(rrr, bbb, ggg) — Specifies an RGB color, very similar to #RRGGBB, except the values are decimal numbers from 0 to 255. For example, rgb(255, 128, 0) ...