Canvas Strokestyle
π
2026-06-14 | π HTML
## HTML Canvas `strokeStyle` Property
The `strokeStyle` property of the Canvas 2D API specifies the color, gradient, or pattern to use for the strokes (outlines) around shapes.
By default, this property is set to `#000000` (solid black).
---
## Syntax
```javascript
context.strokeStyle = color | gradient | pattern;
```
### Property Values
| Value | Description |
| :--- | :--- |
| **`color`** | A string parsing as a CSS `` value (e.g., hexadecimal, RGB, RGBA, HSL, or named colors). The default is `#000000`. |
| **`gradient`** | A `CanvasGradient` object (either linear or radial) created via `createLinearGradient()` or `createRadialGradient()`. |
| **`pattern`** | A `CanvasPattern` object created via `createPattern()` using an image, canvas, or video source. |
---
## Browser Support
The `strokeStyle` property is fully supported by all modern web browsers:
* Google Chrome
* Mozilla Firefox
* Microsoft Edge / Internet Explorer 9+
* Safari
* Opera
*Note: Internet Explorer 8 and earlier versions do not support the `