Candidate Recommendation Draft · css-paint-api

CSS Painting API

1 function defined by this specification, all known to at least one browser .

The feature in detail

paint()

Function Limited availability Modern CSS: paint()

MDN The paint() CSS function defines an image value generated with a PaintWorklet.

Live preview Example from MDN
body {
  font: 1.2em / 1.2 sans-serif;
}
li {
  background-image: paint(boxbg);
  --box-color: hsl(55 90% 60%);
}

li:nth-of-type(3n) {
  --box-color: hsl(155 90% 60%);
  --width-subtractor: 20;
}

li:nth-of-type(3n + 1) {
  --box-color: hsl(255 90% 60%);
  --width-subtractor: 40;
}

Syntax

paint( <ident>, <declaration-value>? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting paint()
Chrome 65
Edge 79
Firefox No
Safari No
Chrome Android 65
Safari iOS No

First version with support, from MDN browser-compat-data.