Docs
Theming
Theme OSAGI Console with semantic design tokens: light and dark mode, the WCAG 2.2 AA contrast check, theme screenshots and a rebrand in four steps.
The console ships one theme, Midnight v2, tuned to meet WCAG 2.2 AA in light and dark mode. Every colour is a semantic token, so a rebrand is a change of token values.
Tokens
All tokens live in styles/theme.css.
| Group | Tokens |
|---|---|
| Surfaces and roles (shadcn) | --background, --foreground, --card, --popover, --primary, --secondary, --muted, --accent, --destructive, --border, --input, --ring, --sidebar-* |
| Statuses | --status-ok-*, --status-info-*, --status-warning-*, --status-critical-*, --status-neutral-* (each with -bg, -fg and -border) |
| Charts | --chart-1 to --chart-5 |
| Extras | --border-subtle, --highlight, --glass-*, --field-error-border |
| Structure | --radius (0.75rem), --ui-text, --row-h, --cell-pad |
Light mode is :root and .light; dark mode is the .dark class that next-themes sets on <html>. Print always uses the light set. Fonts are Geist and Geist Mono, loaded with next/font in app/fonts.ts and shared by every root layout.
Important
Components use tokens only. A unit test fails on hard-coded colours (hex, rgb(), oklch() and the like) and on Tailwind palette utilities such as text-red-600 anywhere in components/**.
Light and dark mode
Both modes are defined in the same file. Light is the console default (defaultTheme of RootDocument in app/root-document.tsx; the landing page starts dark); the theme switch in the shell changes it per browser. When a surface needs a different shade in dark mode, add a token instead of a condition in the component.
Check the contrast
pnpm check:contrastnode scripts/check-contrast.mjs --worst 5The check rates every text pair at 4.5:1 and every border, control and chart colour at 3:1, including hover and focus states, and fails when a token change breaks a pair. --worst 5 also lists the five weakest pairs of each mode.
Take theme screenshots
pnpm build && OSAGI_DEMO_AUTH=on pnpm start -p 3941node scripts/theme-shots.mjs --base http://127.0.0.1:3941The script takes full-page shots of the main screens in both modes, on desktop (1440 px) and phone (390 px) widths, and builds a contact sheet in .artifacts/theme-shots. It fails when a page does not render the theme fonts or radius; after changing them, pass --sans, --mono and --radius with the new values.
Rebrand in four steps
- Change the token values in
styles/theme.css, in both modes. - Run
pnpm check:contrastand fix every failing pair. - Take the theme screenshots.
- Look through the contact sheet and adjust what reads poorly.