Necessary for shadcn/ui

Necessary is a shadcn/ui theme built around a muted green primary color (#4c5346) with muted violet accents (#4d4653). The light mode uses a neutral background (#fafdf7). Dark mode keeps the muted green primary (#4c5346) on a neutral background (#020401).

Color palette

TokenLightDark
Background
#fafdf7mintcream
#020401black
Foreground
#050901black
#fafbf9snow
Card
#fafdf7mintcream
#020401black
Card foreground
#050901black
#fafbf9snow
Popover
#fafdf7mintcream
#020401black
Popover foreground
#050901black
#fafbf9snow
Primary
#4c5346darkslategray
#4c5346darkslategray
Primary foreground
#e5e8e3gainsboro
#e5e8e3gainsboro
Secondary
#4d4653darkslategray
#4d4653darkslategray
Secondary foreground
#e6e3e8gainsboro
#e6e3e8gainsboro
Muted
#f3edf7whitesmoke
#0d0812black
Muted foreground
#4d4653darkslategray
#b3acb9darkgray
Accent
#4d4653darkslategray
#4d4653darkslategray
Accent foreground
#e6e3e8gainsboro
#e6e3e8gainsboro
Destructive
#ae1313firebrick
#dc1818crimson
Destructive foreground
#fef6f6snow
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#4c5346darkslategray
#4c5346darkslategray

Contrast

WCAG 2 contrast ratios between each background and its foreground color.

Light mode
Text on background19.56:1AAA
Text on card19.56:1AAA
Primary button6.47:1AA
Secondary button7.10:1AAA
Muted text7.90:1AAA
Accent7.10:1AAA
Destructive6.76:1AA
Dark mode
Text on background19.83:1AAA
Text on card19.83:1AAA
Primary button6.47:1AA
Secondary button7.10:1AAA
Muted text8.97:1AAA
Accent7.10:1AAA
Destructive4.99:1AA

CSS variables

Paste this into your globals.css to use Necessary in your shadcn/ui project.

:root {
  --radius: 0.5rem;
  --background: oklch(0.99 0.009 129.881);
  --foreground: oklch(0.129 0.026 128.204);
  --muted: oklch(0.954 0.014 309.64);
  --muted-foreground: oklch(0.405 0.025 309.186);
  --popover: oklch(0.99 0.009 129.881);
  --popover-foreground: oklch(0.129 0.026 128.204);
  --card: oklch(0.99 0.009 129.881);
  --card-foreground: oklch(0.129 0.026 128.204);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.431 0.021 130.292);
  --primary-foreground: oklch(0.927 0.006 129.849);
  --secondary: oklch(0.407 0.022 309.254);
  --secondary-foreground: oklch(0.92 0.006 309.721);
  --accent: oklch(0.407 0.022 309.254);
  --accent-foreground: oklch(0.92 0.006 309.721);
  --destructive: oklch(0.48 0.186 28.054);
  --destructive-foreground: oklch(0.979 0.009 17.306);
  --ring: oklch(0.431 0.021 130.292);
  --chart-1: oklch(0.431 0.021 130.292);
  --chart-2: oklch(0.407 0.022 309.254);
  --chart-3: oklch(0.407 0.022 309.254);
  --chart-4: oklch(0.434 0.024 309.247);
  --chart-5: oklch(0.436 0.029 130.48);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.099 0.013 128.717);
  --foreground: oklch(0.986 0.003 129.814);
  --muted: oklch(0.147 0.022 308.548);
  --muted-foreground: oklch(0.754 0.021 309.508);
  --popover: oklch(0.099 0.013 128.717);
  --popover-foreground: oklch(0.986 0.003 129.814);
  --card: oklch(0.099 0.013 128.717);
  --card-foreground: oklch(0.986 0.003 129.814);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.431 0.021 130.292);
  --primary-foreground: oklch(0.927 0.006 129.849);
  --secondary: oklch(0.407 0.022 309.254);
  --secondary-foreground: oklch(0.92 0.006 309.721);
  --accent: oklch(0.407 0.022 309.254);
  --accent-foreground: oklch(0.92 0.006 309.721);
  --destructive: oklch(0.57 0.223 28.235);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.431 0.021 130.292);
  --chart-1: oklch(0.431 0.021 130.292);
  --chart-2: oklch(0.407 0.022 309.254);
  --chart-3: oklch(0.407 0.022 309.254);
  --chart-4: oklch(0.434 0.024 309.247);
  --chart-5: oklch(0.436 0.029 130.48);
}