The fillStyle property sets the color or paint used when Canvas fills a shape or draws text. Set it on the 2D context before calling fill() or fillText(). Canvas defaults to black, so changing fillStyle makes the visual result explicit. section 15.2.3 section 15.2.6
Use fillStyle as part of a small drawing sequence:
- Create a path such as a rectangle, assign a color such as "#6ba5d7", and call fill(). section 15.2.3
- Group shapes that share a fill style, then change fillStyle before drawing the next color group. section 15.2.3
- Use the same property before fillText() to control text color; combine it with font and textAlign for presentation. section 15.2.6
Coloring visualization circles
A Canvas visualization can assign each node’s subject a color through fillStyle, then fill each circle after beginning a new path. Its strokeStyle can independently encode the painting medium. section 15.3
