Personal projectFeb 2021

Inverted Corners

An open source Houdini Paint Worklet for CSS.

A CSS Paint API worklet that renders inverted corners, gradients, masks and image backgrounds from a single element and a few custom properties. Built to find out where the experimental Houdini APIs stop.

At a glance
RoleSole authorPlatformAny browser with CSS Paint APIStackJavaScript, CSS HoudiniLive since2021
HoudiniCSS Paint API worklet
1 propertyInstead of a pile of markup
GradientsAngles, stops, masks, images
Open sourceMIT, on GitHub
Screens

What it draws

The interactive playground and a few interfaces built with the worklet.

The Inverted Corners interactive playground
A browser interface using inverted corners
Gradient fills rendered by the paint worklet
The worklet used as a mask to reshape an element
The work

What I own

A personal experiment, published as a library: written, documented and released on my own.

Corners CSS cannot do

One shorthand, --corner-radius: 20 20 -20 -20, mirrors native border-radius: positive values curve outward, negative ones scoop inward, with no stacked pseudo-elements or clip-path hacks.

Gradients without extra elements

--background takes a color, a list of colors for a gradient, per-color stops, and a leading angle — all painted into the same shape.

Background or mask

Use it as background: paint(inverted-corners) to keep drop-shadow support, or as mask-image to reshape an element and its own background.

Honest about the limits

Paint Worklets are experimental: the library ships a one-line unpkg install, a paintWorklet in CSS feature check, and documented workarounds like list-style-image for images in Chromium.