CSS Painting API - Web APIs | MDN

The CSS Painting API — part of the CSS Houdini umbrella of APIs — allows developers to write JavaScript functions that can draw directly into an element's background, border, or content.

MDN Web Docs