Getting started
Theming
Every color in centerUI is a semantic token, so changing the look of the whole library means editing a handful of CSS variables.
Tokens
Each token has a light and a dark value. Foreground pairs (for example primary-fg) are the readable text color on top of their background. Each color is written five ways, as it is in the theme now: press a button to copy a code.
bg
Page background
OKLCH…HEX…RGB…HSL…HSB…fg
Default text
OKLCH…HEX…RGB…HSL…HSB…card
Raised surfaces
OKLCH…HEX…RGB…HSL…HSB…muted
Subtle backgrounds
OKLCH…HEX…RGB…HSL…HSB…muted-fg
Secondary text
OKLCH…HEX…RGB…HSL…HSB…border
Borders and dividers
OKLCH…HEX…RGB…HSL…HSB…ring
Focus ring
OKLCH…HEX…RGB…HSL…HSB…primary
Primary actions
OKLCH…HEX…RGB…HSL…HSB…secondary
Secondary actions
OKLCH…HEX…RGB…HSL…HSB…danger
Destructive actions
OKLCH…HEX…RGB…HSL…HSB…success
Positive states
OKLCH…HEX…RGB…HSL…HSB…warning
Cautionary states
OKLCH…HEX…RGB…HSL…HSB…
Using tokens
Tokens are registered with Tailwind, so they work in any utility.
<div className="rounded-lg border bg-card p-4 text-card-fg">
<p className="text-muted-fg">Secondary text</p>
</div>Customizing
Override the variables in your global stylesheet. Components pick the change up automatically.
:root {
--primary: light-dark(oklch(0.55 0.2 260), oklch(0.72 0.15 260));
--primary-fg: oklch(0.985 0 0);
--radius: 0.75rem;
}Dark mode
Values are resolved with light-dark(), so the theme follows the operating system by default. Set a class on the html element to force one.
<html class="dark"> <!-- always dark -->
<html class="light"> <!-- always light -->
<html> <!-- follows the OS -->Logo
centerUI has four logos. The one in use is set once, in src/lib/site.ts, and the header, the footer, the demos and the icon of the browser tab all follow it.
square
A rounded square with a ring in its center.
bracket
A C drawn as a bracket, with a block at its center.
orbitin use
A ring with a dot at its center, and a block where it is open.
core
A solid disc with a square window at its center.
// src/lib/site.ts
export const siteConfig = {
...
logo: "orbit", // "square" | "bracket" | "orbit" | "core"
};
// One place can use another logo
<LogoMark variant="core" className="size-6" />