Necessary is a shadcn/ui theme built around a near-black primary color (#1d1b1d) with near-black accents (#1c1d1b). The light mode uses a neutral background (#fbf8fc). Dark mode keeps the near-black primary (#1d1b1d) on a purple-tinted background (#0c070d).
| Token | Light | Dark |
|---|---|---|
| Background | #fbf8fcghostwhite | #0c070dblack |
| Foreground | #0f0212black | #fdfcfdwhite |
| Card | #fbf8fcghostwhite | #0c070dblack |
| Card foreground | #0f0212black | #fdfcfdwhite |
| Popover | #fbf8fcghostwhite | #0c070dblack |
| Popover foreground | #0f0212black | #fdfcfdwhite |
| Primary | #1d1b1dblack | #1d1b1dblack |
| Primary foreground | #b6b3b7silver | #b6b3b7silver |
| Secondary | #1c1d1bblack | #1c1d1bblack |
| Secondary foreground | #b4b7b3silver | #b4b7b3silver |
| Muted | #eaece9linen | #131613black |
| Muted foreground | #555954dimgray | #a7aba6darkgray |
| Accent | #1c1d1bblack | #1c1d1bblack |
| Accent foreground | #b4b7b3silver | #b4b7b3silver |
| Destructive | #e22c03orangered | #f12f04orangered |
| Destructive foreground | #ffffffwhite | #ffffffwhite |
| Border | #e5e7eblavender | #1f2937darkslategray |
| Input | #e5e7eblavender | #1f2937darkslategray |
| Ring | #1d1b1dblack | #1d1b1dblack |
WCAG 2 contrast ratios between each background and its foreground color.
| Text on background | 19.16:1 | AAA |
| Text on card | 19.16:1 | AAA |
| Primary button | 8.24:1 | AAA |
| Secondary button | 8.36:1 | AAA |
| Muted text | 6.00:1 | AA |
| Accent | 8.36:1 | AAA |
| Destructive | 4.56:1 | AA |
| Text on background | 19.49:1 | AAA |
| Text on card | 19.49:1 | AAA |
| Primary button | 8.24:1 | AAA |
| Secondary button | 8.36:1 | AAA |
| Muted text | 7.82:1 | AAA |
| Accent | 8.36:1 | AAA |
| Destructive | 4.07:1 | AA Large |
Paste this into your globals.css to use Necessary in your shadcn/ui project.
:root {
--radius: 0.5rem;
--background: oklch(0.982 0.008 319.998);
--foreground: oklch(0.131 0.046 321.317);
--muted: oklch(0.941 0.005 139.986);
--muted-foreground: oklch(0.46 0.01 139.972);
--popover: oklch(0.982 0.008 319.998);
--popover-foreground: oklch(0.131 0.046 321.317);
--card: oklch(0.982 0.008 319.998);
--card-foreground: oklch(0.131 0.046 321.317);
--border: oklch(0.928 0.006 264.531);
--input: oklch(0.928 0.006 264.531);
--primary: oklch(0.225 0.004 320.007);
--primary-foreground: oklch(0.771 0.007 320);
--secondary: oklch(0.228 0.004 139.976);
--secondary-foreground: oklch(0.776 0.007 139.983);
--accent: oklch(0.228 0.004 139.976);
--accent-foreground: oklch(0.776 0.007 139.983);
--destructive: oklch(0.59 0.22 32.403);
--destructive-foreground: oklch(1 0 180);
--ring: oklch(0.225 0.004 320.007);
--chart-1: oklch(0.225 0.004 320.007);
--chart-2: oklch(0.228 0.004 139.976);
--chart-3: oklch(0.228 0.004 139.976);
--chart-4: oklch(0.261 0.005 139.975);
--chart-5: oklch(0.224 0.008 320.022);
}
.dark {
--radius: 0.5rem;
--background: oklch(0.14 0.016 320.382);
--foreground: oklch(0.991 0.002 319.993);
--muted: oklch(0.196 0.008 139.957);
--muted-foreground: oklch(0.736 0.009 139.98);
--popover: oklch(0.14 0.016 320.382);
--popover-foreground: oklch(0.991 0.002 319.993);
--card: oklch(0.14 0.016 320.382);
--card-foreground: oklch(0.991 0.002 319.993);
--border: oklch(0.278 0.03 256.848);
--input: oklch(0.278 0.03 256.848);
--primary: oklch(0.225 0.004 320.007);
--primary-foreground: oklch(0.771 0.007 320);
--secondary: oklch(0.228 0.004 139.976);
--secondary-foreground: oklch(0.776 0.007 139.983);
--accent: oklch(0.228 0.004 139.976);
--accent-foreground: oklch(0.776 0.007 139.983);
--destructive: oklch(0.619 0.231 32.328);
--destructive-foreground: oklch(1 0 180);
--ring: oklch(0.225 0.004 320.007);
--chart-1: oklch(0.225 0.004 320.007);
--chart-2: oklch(0.228 0.004 139.976);
--chart-3: oklch(0.228 0.004 139.976);
--chart-4: oklch(0.261 0.005 139.975);
--chart-5: oklch(0.224 0.008 320.022);
}