About
xeerpe is a TypeScript library for building CSS backgrounds with a chainable API. You describe the layers you want, and it hands you back a style object ready to use. It has zero dependencies and works with any framework, or none at all.
The idea
Describe a background the way you would say it out loud: start with a green glow, put something dark underneath, lay a grid over the top. xeerpe turns that sentence into CSS.
import { Builder } from 'xeerpe'
const style = new Builder()
.radialGradient({ from: '#34d399', to: 'transparent' })
.linearGradient({ from: '#0b1020', to: '#05060f' })
.grid({ color: '#ffffff', opacity: 0.1 })
.toStyle()Create a Builder, chain whatever you need, and finish with toStyle(). Everything in between is just a method.
What you can make
- Gradients: linear, radial, conic and mesh, stacked as many times as you like.
- Patterns: grids, dots, stars and rays, for when a flat gradient feels too clean.
- Effects: noise, grain, vignette and glow, for texture and light.
- Filters: blur on the element itself, or frosted glass on what sits behind it.
- Animations: nine keyframe animations that move the whole background as one piece.
- Presets: ready-made backgrounds you can use in one line, or extend.
Open source
xeerpe is free to use, read and break. The code lives on GitHub and the package is on npm, under the MIT license.
If something feels clumsy, open an issue. If you already know how to fix it, even better.
Who's behind it
I'm Nicola Centonze, a Frontend Engineer working mostly on design systems and component libraries. xeerpe is one of my open source projects.
If you make something nice with it, I'd love to see it.
