OKLCH Studio · shadcn/ui base colour
shadcn/ui Zinc theme: OKLCH CSS variables, hex & contrast
shadcn/ui Zinc: primary #18181b light / #e4e4e7 dark (oklch(0.21 0.006 285.885)). 21 of 22 checked pairs meet WCAG AA 4.5:1 (light 10/11, dark 11/11). Copy the full light and dark token set as OKLCH, @theme mapping or hex.
Zinc is a base colour: it defines the complete token set for light and dark mode. Source: shadcn/ui (MIT, © 2023 shadcn); all themes.
Preview
Card title
Muted description text on the card.
Muted block with input border
Card title
Muted description text on the card.
Muted block with input border
light mode tokens
| Token | Swatch | oklch() | Hex | In sRGB |
|---|---|---|---|---|
| --background | oklch(1 0 0) | #ffffff | Yes | |
| --foreground | oklch(0.141 0.005 285.823) | #09090b | Yes | |
| --card | oklch(1 0 0) | #ffffff | Yes | |
| --card-foreground | oklch(0.141 0.005 285.823) | #09090b | Yes | |
| --popover | oklch(1 0 0) | #ffffff | Yes | |
| --popover-foreground | oklch(0.141 0.005 285.823) | #09090b | Yes | |
| --primary | oklch(0.21 0.006 285.885) | #18181b | Yes | |
| --primary-foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --secondary | oklch(0.967 0.001 286.375) | #f4f4f5 | Yes | |
| --secondary-foreground | oklch(0.21 0.006 285.885) | #18181b | Yes | |
| --muted | oklch(0.967 0.001 286.375) | #f4f4f5 | Yes | |
| --muted-foreground | oklch(0.552 0.016 285.938) | #71717b | Yes | |
| --accent | oklch(0.967 0.001 286.375) | #f4f4f5 | Yes | |
| --accent-foreground | oklch(0.21 0.006 285.885) | #18181b | Yes | |
| --destructive | oklch(0.577 0.245 27.325) | #e7000b | No — hex is clipped | |
| --border | oklch(0.92 0.004 286.32) | #e4e4e7 | Yes | |
| --input | oklch(0.92 0.004 286.32) | #e4e4e7 | Yes | |
| --ring | oklch(0.705 0.015 286.067) | #9f9fa9 | Yes | |
| --chart-1 | oklch(0.871 0.006 286.286) | #d4d4d8 | Yes | |
| --chart-2 | oklch(0.552 0.016 285.938) | #71717b | Yes | |
| --chart-3 | oklch(0.442 0.017 285.786) | #52525c | Yes | |
| --chart-4 | oklch(0.37 0.013 285.805) | #3f3f46 | Yes | |
| --chart-5 | oklch(0.274 0.006 286.033) | #27272a | Yes | |
| --sidebar | oklch(0.985 0 0) | #fafafa | Yes | |
| --sidebar-foreground | oklch(0.141 0.005 285.823) | #09090b | Yes | |
| --sidebar-primary | oklch(0.21 0.006 285.885) | #18181b | Yes | |
| --sidebar-primary-foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --sidebar-accent | oklch(0.967 0.001 286.375) | #f4f4f5 | Yes | |
| --sidebar-accent-foreground | oklch(0.21 0.006 285.885) | #18181b | Yes | |
| --sidebar-border | oklch(0.92 0.004 286.32) | #e4e4e7 | Yes | |
| --sidebar-ring | oklch(0.705 0.015 286.067) | #9f9fa9 | Yes |
dark mode tokens
| Token | Swatch | oklch() | Hex | In sRGB |
|---|---|---|---|---|
| --background | oklch(0.141 0.005 285.823) | #09090b | Yes | |
| --foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --card | oklch(0.21 0.006 285.885) | #18181b | Yes | |
| --card-foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --popover | oklch(0.21 0.006 285.885) | #18181b | Yes | |
| --popover-foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --primary | oklch(0.92 0.004 286.32) | #e4e4e7 | Yes | |
| --primary-foreground | oklch(0.21 0.006 285.885) | #18181b | Yes | |
| --secondary | oklch(0.274 0.006 286.033) | #27272a | Yes | |
| --secondary-foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --muted | oklch(0.274 0.006 286.033) | #27272a | Yes | |
| --muted-foreground | oklch(0.705 0.015 286.067) | #9f9fa9 | Yes | |
| --accent | oklch(0.274 0.006 286.033) | #27272a | Yes | |
| --accent-foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --destructive | oklch(0.704 0.191 22.216) | #ff6467 | No — hex is clipped | |
| --border | oklch(1 0 0 / 10%) | #ffffff (10% alpha) | Yes | |
| --input | oklch(1 0 0 / 15%) | #ffffff (15% alpha) | Yes | |
| --ring | oklch(0.552 0.016 285.938) | #71717b | Yes | |
| --chart-1 | oklch(0.871 0.006 286.286) | #d4d4d8 | Yes | |
| --chart-2 | oklch(0.552 0.016 285.938) | #71717b | Yes | |
| --chart-3 | oklch(0.442 0.017 285.786) | #52525c | Yes | |
| --chart-4 | oklch(0.37 0.013 285.805) | #3f3f46 | Yes | |
| --chart-5 | oklch(0.274 0.006 286.033) | #27272a | Yes | |
| --sidebar | oklch(0.21 0.006 285.885) | #18181b | Yes | |
| --sidebar-foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --sidebar-primary | oklch(0.488 0.243 264.376) | #1447e6 | Yes | |
| --sidebar-primary-foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --sidebar-accent | oklch(0.274 0.006 286.033) | #27272a | Yes | |
| --sidebar-accent-foreground | oklch(0.985 0 0) | #fafafa | Yes | |
| --sidebar-border | oklch(1 0 0 / 10%) | #ffffff (10% alpha) | Yes | |
| --sidebar-ring | oklch(0.552 0.016 285.938) | #71717b | Yes |
Contrast audit (WCAG 2)
21 of 22 checked pairs meet AA 4.5:1. Pairs with a translucent side are skipped. A suggested fix keeps hue and chroma and moves the foreground's lightness to the nearest AA value, using the same logic as the contrast checker.
| Pair | Ratio | APCA Lc | AA 4.5 | AA large 3 | Fix / details |
|---|---|---|---|---|---|
| foreground on background#09090b on #ffffff | 19.89:1 | 106 | Pass | Pass | Pair page → |
| card-foreground on card#09090b on #ffffff | 19.89:1 | 106 | Pass | Pass | Pair page → |
| popover-foreground on popover#09090b on #ffffff | 19.89:1 | 106 | Pass | Pass | Pair page → |
| primary-foreground on primary#fafafa on #18181b | 16.97:1 | -103 | Pass | Pass | |
| secondary-foreground on secondary#18181b on #f4f4f5 | 16.11:1 | 98 | Pass | Pass | |
| muted-foreground on muted#71717b on #f4f4f5 | 4.39:1 | 67 | Fail | Pass | Set muted-foreground to oklch(0.512 0.015 285.9) (#66666f, 5.17:1). |
| muted-foreground on background#71717b on #ffffff | 4.82:1 | 74 | Pass | Pass | Pair page → |
| accent-foreground on accent#18181b on #f4f4f5 | 16.11:1 | 98 | Pass | Pass | |
| destructive on background#e7000b on #ffffff | 4.76:1 | 70 | Pass | Pass | Pair page → |
| sidebar-foreground on sidebar#09090b on #fafafa | 19.06:1 | 103 | Pass | Pass | |
| sidebar-primary-foreground on sidebar-primary#fafafa on #18181b | 16.97:1 | -103 | Pass | Pass |
| Pair | Ratio | APCA Lc | AA 4.5 | AA large 3 | Fix / details |
|---|---|---|---|---|---|
| foreground on background#fafafa on #09090b | 19.06:1 | -104 | Pass | Pass | |
| card-foreground on card#fafafa on #18181b | 16.97:1 | -103 | Pass | Pass | |
| popover-foreground on popover#fafafa on #18181b | 16.97:1 | -103 | Pass | Pass | |
| primary-foreground on primary#18181b on #e4e4e7 | 13.96:1 | 89 | Pass | Pass | |
| secondary-foreground on secondary#fafafa on #27272a | 14.27:1 | -101 | Pass | Pass | |
| muted-foreground on muted#9f9fa9 on #27272a | 5.67:1 | -47 | Pass | Pass | |
| muted-foreground on background#9f9fa9 on #09090b | 7.58:1 | -51 | Pass | Pass | |
| accent-foreground on accent#fafafa on #27272a | 14.27:1 | -101 | Pass | Pass | |
| destructive on background#ff6467 on #09090b | 6.88:1 | -47 | Pass | Pass | |
| sidebar-foreground on sidebar#fafafa on #18181b | 16.97:1 | -103 | Pass | Pass | |
| sidebar-primary-foreground on sidebar-primary#fafafa on #1447e6 | 6.54:1 | -84 | Pass | Pass |
Copy code
shadcn/ui v4 globals.css (OKLCH)
:root {
--background: oklch(1 0 0);
--foreground: oklch(0.141 0.005 285.823);
--card: oklch(1 0 0);
--card-foreground: oklch(0.141 0.005 285.823);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.141 0.005 285.823);
--primary: oklch(0.21 0.006 285.885);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.967 0.001 286.375);
--secondary-foreground: oklch(0.21 0.006 285.885);
--muted: oklch(0.967 0.001 286.375);
--muted-foreground: oklch(0.552 0.016 285.938);
--accent: oklch(0.967 0.001 286.375);
--accent-foreground: oklch(0.21 0.006 285.885);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.92 0.004 286.32);
--input: oklch(0.92 0.004 286.32);
--ring: oklch(0.705 0.015 286.067);
--chart-1: oklch(0.871 0.006 286.286);
--chart-2: oklch(0.552 0.016 285.938);
--chart-3: oklch(0.442 0.017 285.786);
--chart-4: oklch(0.37 0.013 285.805);
--chart-5: oklch(0.274 0.006 286.033);
--radius: 0.625rem;
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.141 0.005 285.823);
--sidebar-primary: oklch(0.21 0.006 285.885);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.967 0.001 286.375);
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
--sidebar-border: oklch(0.92 0.004 286.32);
--sidebar-ring: oklch(0.705 0.015 286.067);
}
.dark {
--background: oklch(0.141 0.005 285.823);
--foreground: oklch(0.985 0 0);
--card: oklch(0.21 0.006 285.885);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.21 0.006 285.885);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.92 0.004 286.32);
--primary-foreground: oklch(0.21 0.006 285.885);
--secondary: oklch(0.274 0.006 286.033);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.274 0.006 286.033);
--muted-foreground: oklch(0.705 0.015 286.067);
--accent: oklch(0.274 0.006 286.033);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 10%);
--input: oklch(1 0 0 / 15%);
--ring: oklch(0.552 0.016 285.938);
--chart-1: oklch(0.871 0.006 286.286);
--chart-2: oklch(0.552 0.016 285.938);
--chart-3: oklch(0.442 0.017 285.786);
--chart-4: oklch(0.37 0.013 285.805);
--chart-5: oklch(0.274 0.006 286.033);
--sidebar: oklch(0.21 0.006 285.885);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.274 0.006 286.033);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.552 0.016 285.938);
}Tailwind v4 @theme inline mapping
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-chart-1: var(--chart-1);
--color-chart-2: var(--chart-2);
--color-chart-3: var(--chart-3);
--color-chart-4: var(--chart-4);
--color-chart-5: var(--chart-5);
--color-sidebar: var(--sidebar);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
}Hex fallback (for tools without OKLCH support)
:root {
--background: #ffffff;
--foreground: #09090b;
--card: #ffffff;
--card-foreground: #09090b;
--popover: #ffffff;
--popover-foreground: #09090b;
--primary: #18181b;
--primary-foreground: #fafafa;
--secondary: #f4f4f5;
--secondary-foreground: #18181b;
--muted: #f4f4f5;
--muted-foreground: #71717b;
--accent: #f4f4f5;
--accent-foreground: #18181b;
--destructive: #e7000b;
--border: #e4e4e7;
--input: #e4e4e7;
--ring: #9f9fa9;
--chart-1: #d4d4d8;
--chart-2: #71717b;
--chart-3: #52525c;
--chart-4: #3f3f46;
--chart-5: #27272a;
--radius: 0.625rem;
--sidebar: #fafafa;
--sidebar-foreground: #09090b;
--sidebar-primary: #18181b;
--sidebar-primary-foreground: #fafafa;
--sidebar-accent: #f4f4f5;
--sidebar-accent-foreground: #18181b;
--sidebar-border: #e4e4e7;
--sidebar-ring: #9f9fa9;
}
.dark {
--background: #09090b;
--foreground: #fafafa;
--card: #18181b;
--card-foreground: #fafafa;
--popover: #18181b;
--popover-foreground: #fafafa;
--primary: #e4e4e7;
--primary-foreground: #18181b;
--secondary: #27272a;
--secondary-foreground: #fafafa;
--muted: #27272a;
--muted-foreground: #9f9fa9;
--accent: #27272a;
--accent-foreground: #fafafa;
--destructive: #ff6467;
--border: #ffffff1a;
--input: #ffffff26;
--ring: #71717b;
--chart-1: #d4d4d8;
--chart-2: #71717b;
--chart-3: #52525c;
--chart-4: #3f3f46;
--chart-5: #27272a;
--sidebar: #18181b;
--sidebar-foreground: #fafafa;
--sidebar-primary: #1447e6;
--sidebar-primary-foreground: #fafafa;
--sidebar-accent: #27272a;
--sidebar-accent-foreground: #fafafa;
--sidebar-border: #ffffff1a;
--sidebar-ring: #71717b;
}Related colours
Light primary: oklch(0.21 0.006 285.885) · #18181b