Base
Your brand, as tokens
Named CSS custom properties for color, space, type and motion: change a value once, and every page follows.
- 173 tokens
- 3 color modes
- 3.0 KB gzipped
- 0 dependencies
Try it: same HTML, another look
The tokens this look reads
.card { --luz-brand-fill: var(--luz-blue-60); font-family: var(--luz-font-serif); border-radius: var(--luz-radius-md); box-shadow: var(--luz-shadow-sm); transition: var(--luz-duration-base) var(--luz-easing-standard); }.card { --luz-brand-fill: var(--luz-purple-60); font-family: var(--luz-font-sans); border-radius: var(--luz-radius-md); box-shadow: var(--luz-shadow-lg); transition: var(--luz-duration-slow) var(--luz-easing-enter); }.card { --luz-brand-fill: var(--luz-teal-60); font-family: var(--luz-font-sans); border-radius: var(--luz-radius-full); box-shadow: var(--luz-shadow-md); transition: var(--luz-duration-slower) var(--luz-easing-spring); }.card { --luz-brand-fill: var(--luz-green-60); font-family: var(--luz-font-serif); border-radius: var(--luz-radius-sm); box-shadow: var(--luz-shadow-md); transition: var(--luz-duration-lazy) var(--luz-easing-enter); }.card { --luz-brand-fill: var(--luz-red-60); font-family: var(--luz-font-mono); border-radius: var(--luz-radius-none); box-shadow: var(--luz-shadow-sm); transition: var(--luz-duration-fast) var(--luz-easing-linear); }
Use it in three steps
-
1. Install
One package, or one link from the CDN. It adds variables and nothing else.
npm install @luz-ds/tokens<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@luz-ds/tokens@0.5.1/dist/luz-tokens.min.css"> -
2. Write the token, not the value
Wherever you would type a color, a size or a radius, read the token instead.
.card { background: var(--luz-surface); color: var(--luz-text-primary); padding: var(--luz-space-lg); border-radius: var(--luz-radius-md); } -
3. Make it yours
Point the brand tokens at your colors once, and every page follows, in all three modes.
:root { --luz-brand-primary: var(--luz-teal-60); --luz-brand-fill: var(--luz-teal-60); } -
What you get
- Your brand in one file: change a token, and every page follows.
- Light, dark and high contrast with no extra CSS: the tokens change, your rules stay the same.
- Nothing else on the page: no classes, no reset, no JavaScript. Add core when you want components.
Color
Primitives are the raw palette; semantic tokens say what a color does. Your CSS reads the semantic ones, so it works in every mode without a line more.
Semantic colors
background: var(--luz-surface);
color: var(--luz-text-primary);Primitive colors
--luz-brand-primary: var(--luz-blue-60);Scales
Space, type, corners and depth: short scales with names you remember, instead of pixels you guess.
Space and controls
gap: var(--luz-space-md);Type
font-size: var(--luz-text-2xl);Radii
border-radius: var(--luz-radius-md);Shadows
box-shadow: var(--luz-shadow-lg);Motion
Durations and easing curves, named for what they do. They drop to zero when the reader asks for less motion.
transition: opacity
var(--luz-duration-base)
var(--luz-easing-standard);Breakpoints
The widths where a layout may change, from a phone to a wide screen, the same in your media queries and in LUZ.
/* a media query reads no property: */
@media (min-width: 768px) { … }Next: components, when you want them
Tokens alone touch nothing on the page. Core adds styled HTML and components that read these same tokens, so your brand carries over.