Black-and-white for shadcn/ui

Black-and-white is a shadcn/ui theme built around a muted deep teal primary color (#1d2f27) with near-white accents (#e6eae8). The light mode uses a neutral background (#fbfefd). Dark mode keeps the muted deep teal primary (#1d2f27) on a neutral background (#000000).

Color palette

TokenLightDark
Background
#fbfefdwhite
#000000black
Foreground
#020e08black
#f8fcfamintcream
Card
#fbfefdwhite
#000000black
Card foreground
#020e08black
#f8fcfamintcream
Popover
#fbfefdwhite
#000000black
Popover foreground
#020e08black
#f8fcfamintcream
Primary
#1d2f27darkslategray
#1d2f27darkslategray
Primary foreground
#b0cfc1silver
#b0cfc1silver
Secondary
#e6eae8lavender
#2e3833darkslategray
Secondary foreground
#4a5550darkslategray
#c7d1cclightgrey
Muted
#eaf6f0honeydew
#091510black
Muted foreground
#4e5f58dimgray
#a0b1a9darkgray
Accent
#e6eae8lavender
#2e3833darkslategray
Accent foreground
#4a5550darkslategray
#c7d1cclightgrey
Destructive
#6d2d08saddlebrown
#f07e3dcoral
Destructive foreground
#f9caaepeachpuff
#000000black
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#1d2f27darkslategray
#1d2f27darkslategray

Contrast

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

Light mode
Text on background19.35:1AAA
Text on card19.35:1AAA
Primary button8.38:1AAA
Secondary button6.38:1AA
Muted text6.08:1AA
Accent6.38:1AA
Destructive6.92:1AA
Dark mode
Text on background20.29:1AAA
Text on card20.29:1AAA
Primary button8.38:1AAA
Secondary button7.78:1AAA
Muted text8.29:1AAA
Accent7.78:1AAA
Destructive7.79:1AAA

CSS variables

Paste this into your globals.css to use Black-and-white in your shadcn/ui project.

:root {
  --radius: 0.5rem;
  --background: oklch(0.994 0.004 167.708);
  --foreground: oklch(0.147 0.025 167.108);
  --muted: oklch(0.962 0.014 167.403);
  --muted-foreground: oklch(0.47 0.025 166.275);
  --popover: oklch(0.994 0.004 167.708);
  --popover-foreground: oklch(0.147 0.025 167.108);
  --card: oklch(0.994 0.004 167.708);
  --card-foreground: oklch(0.147 0.025 167.108);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.288 0.029 164.678);
  --primary-foreground: oklch(0.827 0.038 166.481);
  --secondary: oklch(0.933 0.004 167.696);
  --secondary-foreground: oklch(0.437 0.016 166.75);
  --accent: oklch(0.933 0.004 167.696);
  --accent-foreground: oklch(0.437 0.016 166.75);
  --destructive: oklch(0.382 0.102 45.374);
  --destructive-foreground: oklch(0.872 0.065 51.629);
  --ring: oklch(0.288 0.029 164.678);
  --chart-1: oklch(0.288 0.029 164.678);
  --chart-2: oklch(0.933 0.004 167.696);
  --chart-3: oklch(0.933 0.004 167.696);
  --chart-4: oklch(0.956 0.003 167.737);
  --chart-5: oklch(0.291 0.032 164.287);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0 0 0);
  --foreground: oklch(0.987 0.005 167.684);
  --muted: oklch(0.183 0.02 164.285);
  --muted-foreground: oklch(0.745 0.022 166.963);
  --popover: oklch(0 0 0);
  --popover-foreground: oklch(0.987 0.005 167.684);
  --card: oklch(0 0 0);
  --card-foreground: oklch(0.987 0.005 167.684);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.288 0.029 164.678);
  --primary-foreground: oklch(0.827 0.038 166.481);
  --secondary: oklch(0.329 0.014 166.551);
  --secondary-foreground: oklch(0.851 0.011 167.436);
  --accent: oklch(0.329 0.014 166.551);
  --accent-foreground: oklch(0.851 0.011 167.436);
  --destructive: oklch(0.712 0.16 47.965);
  --destructive-foreground: oklch(0 0 0);
  --ring: oklch(0.288 0.029 164.678);
  --chart-1: oklch(0.288 0.029 164.678);
  --chart-2: oklch(0.329 0.014 166.551);
  --chart-3: oklch(0.329 0.014 166.551);
  --chart-4: oklch(0.36 0.016 166.515);
  --chart-5: oklch(0.291 0.032 164.287);
}