The canvas strokeStyle property is used to set or return the stroke of color, gradient, or pattern used in the drawing.
- color: It is used to set the filled color of drawing. The default value of canvas fillStyle property is black.
- gradient: It is used to set the gradient object to fill the drawing. The gradient object are linear or radial.
- pattern: It is used to set the pattern to fill the drawing.
Example 1: This example uses canvas strokeStyle property to set the stroke color to green.
Example 2: This example uses canvas strokeStyle property to set the stroke color using linear gradient.
Supported Browsers: The browsers supported by canvas strokeStyle property are listed below:
- Google Chrome
- Internet Explorer 9.0
- HTML | canvas fillStyle Property
- HTML | canvas shadowColor Property
- HTML | canvas shadowBlur Property
- HTML | canvas shadowOffsetY Property
- HTML | canvas shadowOffsetX Property
- HTML | canvas Tag
- HTML | Canvas Basics
- HTML | DOM Canvas Object
- HTML | <canvas> height Attribute
- HTML | canvas rect() Method
- HTML | canvas clearRect() Method
- HTML | canvas strokeRect() Method
- HTML | canvas fillRect() Method
- HTML | canvas fill() Method
- HTML | canvas stroke() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.