Necessary for shadcn/ui

Necessary is a shadcn/ui theme built around a muted green primary color (#74af82) with muted purple accents (#af74a1). The light mode uses a neutral background (#fbfefc). Dark mode keeps the muted green primary (#74af82) on a green-tinted background (#060f08).

Color palette

TokenLightDark
Background
#fbfefcwhite
#060f08black
Foreground
#030d05black
#ffffffwhite
Card
#fbfefcwhite
#060f08black
Card foreground
#030d05black
#ffffffwhite
Popover
#fbfefcwhite
#060f08black
Popover foreground
#030d05black
#ffffffwhite
Primary
#74af82darkseagreen
#74af82darkseagreen
Primary foreground
#000000black
#000000black
Secondary
#af74a1rosybrown
#af74a1rosybrown
Secondary foreground
#000000black
#000000black
Muted
#efe6edlavender
#191017black
Muted foreground
#4b3f48darkslategray
#c0b4bdsilver
Accent
#af74a1rosybrown
#af74a1rosybrown
Accent foreground
#000000black
#000000black
Destructive
#e41f01red
#fe2301orangered
Destructive foreground
#ffffffwhite
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#74af82darkseagreen
#74af82darkseagreen

Contrast

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

Light mode
Text on background19.43:1AAA
Text on card19.43:1AAA
Primary button8.18:1AAA
Secondary button5.82:1AA
Muted text8.17:1AAA
Accent5.82:1AA
Destructive4.65:1AA
Dark mode
Text on background19.47:1AAA
Text on card19.47:1AAA
Primary button8.18:1AAA
Secondary button5.82:1AA
Muted text9.33:1AAA
Accent5.82:1AA
Destructive3.85:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.994 0.004 153.169);
  --foreground: oklch(0.143 0.027 152.158);
  --muted: oklch(0.934 0.014 333.49);
  --muted-foreground: oklch(0.383 0.023 334.18);
  --popover: oklch(0.994 0.004 153.169);
  --popover-foreground: oklch(0.143 0.027 152.158);
  --card: oklch(0.994 0.004 153.169);
  --card-foreground: oklch(0.143 0.027 152.158);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.701 0.091 150.869);
  --primary-foreground: oklch(0 0 0);
  --secondary: oklch(0.635 0.096 335.519);
  --secondary-foreground: oklch(0 0 0);
  --accent: oklch(0.635 0.096 335.519);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.587 0.228 30.976);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.701 0.091 150.869);
  --chart-1: oklch(0.701 0.091 150.869);
  --chart-2: oklch(0.635 0.096 335.519);
  --chart-3: oklch(0.635 0.096 335.519);
  --chart-4: oklch(0.66 0.089 335.273);
  --chart-5: oklch(0.706 0.1 150.61);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.155 0.022 151.95);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.187 0.022 335.003);
  --muted-foreground: oklch(0.783 0.019 333.632);
  --popover: oklch(0.155 0.022 151.95);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.155 0.022 151.95);
  --card-foreground: oklch(1 0 180);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.701 0.091 150.869);
  --primary-foreground: oklch(0 0 0);
  --secondary: oklch(0.635 0.096 335.519);
  --secondary-foreground: oklch(0 0 0);
  --accent: oklch(0.635 0.096 335.519);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.635 0.248 30.877);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.701 0.091 150.869);
  --chart-1: oklch(0.701 0.091 150.869);
  --chart-2: oklch(0.635 0.096 335.519);
  --chart-3: oklch(0.635 0.096 335.519);
  --chart-4: oklch(0.66 0.089 335.273);
  --chart-5: oklch(0.706 0.1 150.61);
}