Black-and-white for shadcn/ui

Black-and-white is a shadcn/ui theme built around a violet primary color (#b391d4) with purple accents (#d491d4). The light mode uses a neutral background (#fcfbfe). Dark mode keeps the violet primary (#b391d4) on a neutral background (#000000).

Color palette

TokenLightDark
Background
#fcfbfewhite
#000000black
Foreground
#000000black
#ffffffwhite
Card
#faf8fcghostwhite
#030303black
Card foreground
#000000black
#ffffffwhite
Popover
#faf8fcghostwhite
#030303black
Popover foreground
#000000black
#ffffffwhite
Primary
#b391d4plum
#b391d4plum
Primary foreground
#1a0e25black
#1a0e25black
Secondary
#9191d4mediumpurple
#9191d4mediumpurple
Secondary foreground
#0e0e25black
#0e0e25black
Muted
#e7e7f4lavender
#0b0b18black
Muted foreground
#41414edarkslategray
#b1b1besilver
Accent
#d491d4plum
#d491d4plum
Accent foreground
#250e25black
#250e25black
Destructive
#ab0803darkred
#e20b03red
Destructive foreground
#ffe2e1mistyrose
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#b391d4plum
#b391d4plum

Contrast

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

Light mode
Text on background20.41:1AAA
Text on card19.83:1AAA
Primary button6.96:1AA
Secondary button6.49:1AA
Muted text8.17:1AAA
Accent7.53:1AAA
Destructive6.22:1AA
Dark mode
Text on background21.00:1AAA
Text on card20.67:1AAA
Primary button6.96:1AA
Secondary button6.49:1AA
Muted text9.18:1AAA
Accent7.53:1AAA
Destructive4.90:1AA

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.99 0.003 308.422);
  --foreground: oklch(0 0 0);
  --muted: oklch(0.931 0.017 286.059);
  --muted-foreground: oklch(0.38 0.022 285.32);
  --popover: oklch(0.981 0.007 308.383);
  --popover-foreground: oklch(0 0 0);
  --card: oklch(0.981 0.007 308.383);
  --card-foreground: oklch(0 0 0);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.711 0.102 306.836);
  --primary-foreground: oklch(0.193 0.046 305.596);
  --secondary: oklch(0.682 0.099 283.479);
  --secondary-foreground: oklch(0.18 0.045 280.837);
  --accent: oklch(0.745 0.12 326.696);
  --accent-foreground: oklch(0.21 0.053 327.262);
  --destructive: oklch(0.468 0.188 29.497);
  --destructive-foreground: oklch(0.936 0.032 20.101);
  --ring: oklch(0.711 0.102 306.836);
  --chart-1: oklch(0.711 0.102 306.836);
  --chart-2: oklch(0.682 0.099 283.479);
  --chart-3: oklch(0.745 0.12 326.696);
  --chart-4: oklch(0.715 0.088 283.959);
  --chart-5: oklch(0.708 0.109 306.711);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0 0 0);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.159 0.027 282.894);
  --muted-foreground: oklch(0.765 0.018 285.962);
  --popover: oklch(0.092 0 180);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.092 0 180);
  --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.711 0.102 306.836);
  --primary-foreground: oklch(0.193 0.046 305.596);
  --secondary: oklch(0.682 0.099 283.479);
  --secondary-foreground: oklch(0.18 0.045 280.837);
  --accent: oklch(0.745 0.12 326.696);
  --accent-foreground: oklch(0.21 0.053 327.262);
  --destructive: oklch(0.576 0.233 29.42);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.711 0.102 306.836);
  --chart-1: oklch(0.711 0.102 306.836);
  --chart-2: oklch(0.682 0.099 283.479);
  --chart-3: oklch(0.745 0.12 326.696);
  --chart-4: oklch(0.715 0.088 283.959);
  --chart-5: oklch(0.708 0.109 306.711);
}