paint()Limited availability
The paint() CSS function creates a custom image, drawn using a paint worklet, for an element's background or border.
Not yet supported in all major browsers — check the table and provide a fallback.
Browser support
DesktopChrome
1–64Not supported
65+Supportedsince Mar 6, 2018
Current: 155Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154Firefox
✕Not supportedup to 157
Current: 157Safari
✕Not supportedup to 27
Current: 27MobileChrome Android
18–64Not supported
65+Supportedsince Mar 6, 2018
Current: 155Firefox Android
✕Not supportedup to 157
Current: 157Safari iOS
✕Not supportedup to 27
Current: 27How to use
Not supported in Firefox, Safari, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.
Example
Full syntax and examples are on MDN: paintWorklet static.
Feature detection
JS · check before using
if ("PaintRenderingContext2D" in globalThis) {
// PaintRenderingContext2D is available
} else {
// load a polyfill or use a fallback
}Sub-features
Support for each part of the feature (49). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| CSS.paintWorklet_static | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.beginPath | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.clearRect | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.clip | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.createLinearGradient | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.createPattern | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.createRadialGradient | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.drawImage | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.fill | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.fillRect | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.fillStyle | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.filter | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.getLineDash | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.getTransform | 68 | 79 | ✕ | ✕ | 68 | ✕ | ✕ |
| PaintRenderingContext2D.globalAlpha | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.globalCompositeOperation | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.imageSmoothingEnabled | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |
| PaintRenderingContext2D.imageSmoothingQuality | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| PaintRenderingContext2D.isPointInPath | 65 | 79 | ✕ | ✕ | 65 | ✕ | ✕ |