HTML and CSS Reference
In-Depth Information
Figure 3-4. Setting the font as bold and italic
Font Color
Setting the font color for text rendered on HTML5 Canvas is as simple as setting the
context.fillStyle or context.strokeStyle property to a valid CSS RGB color. Use
the format “#RRGGBB”, where RR is the red component hexadecimal value, GG is
the green component hexadecimal value, and BB is the blue component hexadecimal
value. Here are some examples:
context.fillStyle = "#FF0000";
Sets the text fill to red.
context.strokeStyle = "#FF00FF";
Sets the text stroke to purple.
context.fillStyle = "#FFFF00";
Sets the text fill to yellow.
Search WWH ::

Custom Search