Color system
The library implements a semantic color system in the style of Ionic: each color has a name (primary, secondary, etc.) and is automatically assigned to the corresponding Catppuccin token according to the active theme (dark/light).
Types
ts
1type Color =2 | 'primary' // main accent3 | 'secondary' // secondary accent4 | 'tertiary' // tertiary accent5 | 'success' // successful operation6 | 'warning' // warning7 | 'danger' // error or danger8 | 'light' // light shade (background)9 | 'medium' // medium shade (borders/secondary text)10 | 'dark'; // dark shade (main text)1112type Fill = 'solid' | 'outline' | 'clear';Fill only applies to Button and ButtonGroup.
Demo — full palette
Background (.bg-color-{name})
primarysecondarytertiarysuccesswarningdangerlightmediumdark
Text (.color-{name})
█ primary █ secondary █ tertiary █ success █ warning █ danger █ light █ medium █ dark
Border (.bd-color-{name})
█ primary █ secondary █ tertiary █ success █ warning █ danger █ light █ medium █ dark
CSS variables
Each semantic color exposes a --color-{name} variable that is automatically redefined according to the active theme.
| Variable | Dark theme (Mocha) | Light theme (Latte) |
|---|---|---|
--color-primary | --ctp-mocha-mauve | --ctp-latte-mauve |
--color-secondary | --ctp-mocha-lavender | --ctp-latte-lavender |
--color-tertiary | --ctp-mocha-blue | --ctp-latte-blue |
--color-success | --ctp-mocha-green | --ctp-latte-green |
--color-warning | --ctp-mocha-yellow | --ctp-latte-yellow |
--color-danger | --ctp-mocha-red | --ctp-latte-red |
--color-light | --ctp-mocha-rosewater | --ctp-latte-surface1 |
--color-medium | --ctp-mocha-overlay2 | --ctp-latte-overlay0 |
--color-dark | --ctp-mocha-subtext1 | --ctp-latte-text |
Customizing colors
You can override any color variable to customize the theme:
css
1:root {2 --color-primary: #ff00aa;3 --color-danger: #ff4444;4}You can also redefine it only for dark or light theme using .theme-dark or .theme-light:
css
1.theme-dark {2 --color-primary: #ff00aa;3}Adding a color
You can extend the system with custom colors. Define the variables in :root and create a utility class:
css
1:root {2 --color-favorite: #69bb7b;3}45.color-favorite { color: var(--color-favorite); }6.bg-color-favorite { background: var(--color-favorite); }7.bd-color-favorite { border-color: var(--color-favorite); }Then use the color in any component via classes:
html
1<span class="color-favorite">Favorite text</span>Utility classes
Available for use outside of components:
| Class | Effect |
|---|---|
.color-{name} | color |
.bg-color-{name} | background |
.bd-color-{name} | border-color |
html
1<span class="bg-color-danger color-dark bd-color-warning">2 Alert3</span>