CSS Paint Worklet: Level Up Your Background Images

This example demonstrates creating dynamic background images using CSS Paint Worklet. By defining custom properties `--boxColor` and `--widthSubtractor`, and using the CSS `nth-of-type` selector, we generate background images with varying colors and widths for list items. The JavaScript registers an external paint worklet script, `boxbg.js`, which contains the logic for drawing the background. The final result is customizable; tweak the custom property values in DevTools to alter the colors and widths.
Read more