Theme
Use NgOatThemeRef to manipulate Oat design tokens at runtime. Every --oat-* token maps to an upstream Oat CSS variable so your overrides apply globally.
Live token editor
Spacing & radius
Preview
Sample card
This card reflects the current token values.
Form elements
Preset themes
Click a preset to apply it. Each theme provides light-dark() values so it works in both light & dark modes.
Token reference
All available --oat-* tokens grouped by category. Each maps to an upstream Oat CSS variable.
Color tokens
| Token | Upstream CSS var | Description | Default (light) | Default (dark) |
|---|---|---|---|---|
--oat-background | --background | Page background | #fff | #09090b |
--oat-foreground | --foreground | Default text color | #09090b | #fafafa |
--oat-card | --card | Card / surface background | #fff | #18181b |
--oat-card-foreground | --card-foreground | Text on cards | #09090b | #fafafa |
--oat-primary | --primary | Primary brand color | #574747 | #fafafa |
--oat-primary-foreground | --primary-foreground | Text on primary bg | #fafafa | #18181b |
--oat-secondary | --secondary | Secondary surfaces | #f4f4f5 | #27272a |
--oat-secondary-foreground | --secondary-foreground | Text on secondary | #574747 | #fafafa |
--oat-muted | --muted | Muted / disabled bg | #f4f4f5 | #27272a |
--oat-muted-foreground | --muted-foreground | Muted / placeholder text | #71717a | #a1a1aa |
--oat-accent | --accent | Accent / hover bg | #f4f4f5 | #27272a |
--oat-faint | --faint | Faintest background layer | #fafafa | #1e1e21 |
--oat-faint-foreground | --faint-foreground | Text on faint bg | #a1a1aa | #71717a |
--oat-danger | --danger | Error / destructive color | #d32f2f | #f4807b |
--oat-danger-foreground | --danger-foreground | Text on danger bg | #fafafa | #18181b |
--oat-success | --success | Success color | #008032 | #6cc070 |
--oat-success-foreground | --success-foreground | Text on success bg | #fafafa | #18181b |
--oat-warning | --warning | Warning color | #a65b00 | #f0a030 |
--oat-warning-foreground | --warning-foreground | Text on warning bg | #09090b | |
--oat-border | --border | Default border color | #d4d4d8 | #52525b |
--oat-input | --input | Input field border | #d4d4d8 | #52525b |
--oat-ring | --ring | Focus ring color | #574747 | #d4d4d8 |
Spacing tokens
| Token | Upstream | Default |
|---|---|---|
--oat-space-1 | --space-1 | 0.25rem (4px) |
--oat-space-2 | --space-2 | 0.5rem (8px) |
--oat-space-3 | --space-3 | 0.75rem (12px) |
--oat-space-4 | --space-4 | 1rem (16px) |
--oat-space-5 | --space-5 | 1.25rem (20px) |
--oat-space-6 | --space-6 | 1.5rem (24px) |
--oat-space-8 | --space-8 | 2rem (32px) |
--oat-space-10 | --space-10 | 2.5rem (40px) |
--oat-space-12 | --space-12 | 3rem (48px) |
--oat-space-14 | --space-14 | 3.5rem (56px) |
--oat-space-16 | --space-16 | 4rem (64px) |
--oat-space-18 | --space-18 | 4.5rem (72px) |
Border radius tokens
| Token | Upstream | Default |
|---|---|---|
--oat-radius-small | --radius-small | 0.125rem (2px) |
--oat-radius-medium | --radius-medium | 0.375rem (6px) |
--oat-radius-large | --radius-large | 0.75rem (12px) |
--oat-radius-full | --radius-full | 9999px |
Typography tokens
| Token | Upstream | Default |
|---|---|---|
--oat-font-sans | --font-sans | system-ui, sans-serif |
--oat-font-mono | --font-mono | ui-monospace, Consolas, monospace |
--oat-text-1 β¦ --oat-text-8 | --text-1 β¦ --text-8 | Fluid scale from 2.25rem β 0.75rem |
--oat-font-normal | --font-normal | 400 |
--oat-font-medium | --font-medium | 500 |
--oat-font-semibold | --font-semibold | 600 |
--oat-font-bold | --font-bold | 700 |
Shadow & misc tokens
| Token | Upstream | Description |
|---|---|---|
--oat-shadow-small | --shadow-small | Subtle shadow for cards, tooltips |
--oat-shadow-medium | --shadow-medium | Medium shadow for dropdowns |
--oat-shadow-large | --shadow-large | Prominent shadow for modals |
--oat-transition | --transition | Default transition duration |
--oat-transition-fast | --transition-fast | Fast transition duration |
--oat-z-dropdown | --z-dropdown | z-index for dropdowns |
--oat-z-modal | --z-modal | z-index for modals |
--oat-bar-height | --bar-height | Progress/meter bar height |
Customization examples
1 β Override tokens in CSS (zero JS)
The simplest approach. Add overrides in your global stylesheet:
/* styles.css */
:root {
--primary: #3b82f6; /* Override upstream Oat variable directly */
--radius-medium: 0.75rem; /* Rounder corners */
--border: #e2e8f0;
}2 β Use provideNgOatTheme() at bootstrap
Set tokens via Angular DI so they're applied before the first render:
// app.config.ts
import { provideNgOatTheme } from '@letsprogram/ng-oat';
export const appConfig = {
providers: [
provideNgOatTheme({
tokens: {
'--oat-primary': '#3b82f6',
'--oat-primary-foreground': '#ffffff',
'--oat-radius-medium': '0.75rem',
},
}),
],
};3 β Switch themes at runtime
Inject NgOatThemeRef and call setTokens() whenever you want:
// my-settings.component.ts
import { NgOatThemeRef } from '@letsprogram/ng-oat';
export class SettingsComponent {
private theme = inject(NgOatThemeRef);
applyBrand() {
this.theme.setTokens({
'--oat-primary': '#0ea5e9',
'--oat-primary-foreground': '#ffffff',
'--oat-background': 'light-dark(#f8fafc, #0f172a)',
'--oat-foreground': 'light-dark(#0f172a, #f1f5f9)',
'--oat-border': 'light-dark(#cbd5e1, #334155)',
});
}
reset() {
this.theme.resetTokens();
}
}4 β Scope tokens to a section
Apply tokens to a specific container instead of :root:
provideNgOatTheme({
tokens: { '--oat-primary': '#e11d48' },
scope: '#admin-panel', // CSS selector
})
// Or change scope at runtime:
this.theme.setScope('#admin-panel');5 β Support light-dark() for both modes
Use light-dark(lightValue, darkValue) to ensure your theme works in both color schemes:
this.theme.setTokens({
'--oat-primary': 'light-dark(#2563eb, #60a5fa)',
'--oat-background': 'light-dark(#ffffff, #0c0a09)',
'--oat-foreground': 'light-dark(#1c1917, #fafaf9)',
'--oat-card': 'light-dark(#ffffff, #1c1917)',
'--oat-border': 'light-dark(#d6d3d1, #44403c)',
});