guides
Colors
Every color token in the cnippet ui theme, in light and dark, with the Tailwind class and CSS variable to use.
cnippet ui colors are CSS variables built on the Tailwind CSS palette. Each token has a light value in :root and a dark value in .dark. Tailwind turns each one into utilities, so --primary becomes bg-primary, text-primary, border-primary and so on.
Each swatch shows the light value on the left and the dark value on the right. The copy button copies the CSS variable, for example var(--primary).
Surfaces
6 tokens--background
- light
- var(--color-white)
- dark
- color-mix(in srgb, var(--color-neutral-950) 95%, var(--color-white))
--foreground
- light
- var(--color-neutral-800)
- dark
- var(--color-neutral-100)
--card
- light
- var(--color-white)
- dark
- color-mix(in srgb, var(--background) 98%, var(--color-white))
--card-foreground
- light
- var(--color-neutral-800)
- dark
- var(--color-neutral-100)
--popover
- light
- var(--color-white)
- dark
- color-mix(in srgb, var(--background) 98%, var(--color-white))
--popover-foreground
- light
- var(--color-neutral-800)
- dark
- var(--color-neutral-100)
Actions
8 tokens--primary
- light
- var(--color-neutral-800)
- dark
- var(--color-neutral-100)
--primary-foreground
- light
- var(--color-neutral-50)
- dark
- var(--color-neutral-800)
--secondary
- light
- --alpha(var(--color-black) / 4%)
- dark
- --alpha(var(--color-white) / 4%)
--secondary-foreground
- light
- var(--color-neutral-800)
- dark
- var(--color-neutral-100)
--accent
- light
- --alpha(var(--color-black) / 4%)
- dark
- --alpha(var(--color-white) / 4%)
--accent-foreground
- light
- var(--color-neutral-800)
- dark
- var(--color-neutral-100)
--muted
- light
- --alpha(var(--color-black) / 4%)
- dark
- --alpha(var(--color-white) / 4%)
--muted-foreground
- light
- color-mix(in srgb, var(--color-neutral-500) 90%, var(--color-black))
- dark
- color-mix(in srgb, var(--color-neutral-500) 90%, var(--color-white))
Status
8 tokens--destructive
- light
- var(--color-red-500)
- dark
- color-mix(in srgb, var(--color-red-500) 90%, var(--color-white))
--destructive-foreground
- light
- var(--color-red-700)
- dark
- var(--color-red-400)
--info
- light
- var(--color-blue-500)
- dark
- var(--color-blue-500)
--info-foreground
- light
- var(--color-blue-700)
- dark
- var(--color-blue-400)
--success
- light
- var(--color-emerald-500)
- dark
- var(--color-emerald-500)
--success-foreground
- light
- var(--color-emerald-700)
- dark
- var(--color-emerald-400)
--warning
- light
- var(--color-amber-500)
- dark
- var(--color-amber-500)
--warning-foreground
- light
- var(--color-amber-700)
- dark
- var(--color-amber-400)
Lines
3 tokens--border
- light
- --alpha(var(--color-black) / 8%)
- dark
- --alpha(var(--color-white) / 6%)
--input
- light
- --alpha(var(--color-black) / 10%)
- dark
- --alpha(var(--color-white) / 8%)
--ring
- light
- var(--color-neutral-400)
- dark
- var(--color-neutral-500)
Charts
5 tokens--chart-1
- light
- var(--color-orange-600)
- dark
- var(--color-blue-700)
--chart-2
- light
- var(--color-teal-600)
- dark
- var(--color-emerald-500)
--chart-3
- light
- var(--color-cyan-900)
- dark
- var(--color-amber-500)
--chart-4
- light
- var(--color-amber-400)
- dark
- var(--color-purple-500)
--chart-5
- light
- var(--color-amber-500)
- dark
- var(--color-rose-500)
Sidebar
8 tokens--sidebar
- light
- var(--color-neutral-50)
- dark
- color-mix(in srgb, var(--color-neutral-950) 97%, var(--color-white))
--sidebar-foreground
- light
- color-mix(in srgb, var(--color-neutral-800) 64%, var(--sidebar))
- dark
- color-mix(in srgb, var(--color-neutral-100) 64%, var(--sidebar))
--sidebar-primary
- light
- var(--color-neutral-800)
- dark
- var(--color-neutral-100)
--sidebar-primary-foreground
- light
- var(--color-neutral-50)
- dark
- var(--color-neutral-800)
--sidebar-accent
- light
- --alpha(var(--color-black) / 4%)
- dark
- --alpha(var(--color-white) / 4%)
--sidebar-accent-foreground
- light
- var(--color-neutral-800)
- dark
- var(--color-neutral-100)
--sidebar-border
- light
- --alpha(var(--color-black) / 6%)
- dark
- --alpha(var(--color-white) / 5%)
--sidebar-ring
- light
- var(--color-neutral-400)
- dark
- var(--color-neutral-400)
Code
3 tokens--code
- light
- var(--color-white)
- dark
- color-mix(in srgb, var(--background) 98%, var(--color-white))
--code-foreground
- light
- var(--foreground)
- dark
- var(--foreground)
--code-highlight
- light
- --alpha(var(--color-black) / 4%)
- dark
- --alpha(var(--color-white) / 4%)
Using tokens
Use the Tailwind utilities in your components. Pair every surface token with its -foreground token so text stays readable in both themes:
Opacity modifiers work on every token, for example bg-primary/10 or border-destructive/32.
In plain CSS or inline styles, use the variable:
Status colors
info, success and warning are extra tokens that shadcn/ui doesn't have. Each has two values:
- The base token (
--success) is a strong color for fills, borders, icons and dots. - The
-foregroundtoken (--success-foreground) is a darker shade in light mode and a lighter one in dark mode, for text on the page background or on a light tint such asbg-success/8.
destructive works the same way. Alert, Badge and Toast use these tokens for their info, success, warning and error variants.
Changing colors
To change a color, edit its value in both :root and .dark in your global stylesheet. Anything you don't override keeps the default. See Theming for custom palettes and Dark Mode for switching themes.
Full CSS
This is the :root and .dark CSS that npx shadcn@latest init @cnippet/style adds. --alpha() is a Tailwind CSS v4 function, so this CSS must be processed by Tailwind.