VOOZH about

URL: https://www.geeksforgeeks.org/html/html-canvas-strokestyle-property/

⇱ HTML canvas strokeStyle Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML canvas strokeStyle Property

Last Updated : 9 Jun, 2023

The canvas strokeStyle property is used to set or return the stroke of color, gradient, or pattern used in the drawing. Syntax:

context.strokeStyle=color|gradient|pattern;

Property Value:

  • 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. 

Output: 👁 Image
Example 2: This example uses canvas strokeStyle property to set the stroke color using linear gradient. 

Output: 👁 Image
Supported Browsers: The browsers supported by canvas strokeStyle property are listed below:

  • Google Chrome
  • Internet Explorer 9.0
  • Firefox
  • Safari
  • Opera
Comment
Article Tags: