Badge
--convexity: 6
Open source · MIT
Add an adaptive metallic finish to ordinary container elements. MetalliCSS reads each box, its fallback color, and custom properties, then redraws when that element changes size or style.
Ordinary markup, uncommon finish
MetalliCSS follows the box it is given, from tight controls to full interface panels. The examples below are live elements rendered by the same local module as the playground.
--convexity: 6
--convexity: -3
--metal: neutral
prefers-reduced-motion
The honest version
You keep control of the element and its content. MetalliCSS is responsible for one thing: turning its geometry and CSS variables into a responsive reflection.
The renderer reads computed dimensions, color, corner radius, and the MetalliCSS custom properties.
A reflection and displacement field are composed for that exact box—convex, flat, or inset.
The result is painted behind your content. Managed elements refresh after their class, inline style, or dimensions change.
Modern-browser progressive enhancement, no remote image request, and no runtime package dependencies.
Namespaced color, light, intensity, and resolution inputs with documented ranges and predictable fallbacks.
Research whether a Paint Worklet can improve measured performance while preserving the Canvas renderer as a reliable fallback.
Start with one element
Install the module, add the class, then tune the material in the same stylesheet as the rest of your interface.
terminal
npm install metallicss
app.js
import { metallicss } from "metallicss";
metallicss(document.querySelector(".metallicss"));
styles.css
.metallicss {
--metal: silver;
--convexity: 5;
border-radius: 2rem;
}
Built in the open