ModernTheme for shadcn/ui

ModernTheme is a shadcn/ui theme built around a near-black primary color (#000000) with near-black accents (#000000). The light mode uses a neutral background (#fbf8fc). Dark mode switches to a near-white primary (#ffffff) on a neutral background (#000000).

Color palette

TokenLightDark
Background
#fbf8fcghostwhite
#000000black
Foreground
#000000black
#ffffffwhite
Card
#fbf8fcghostwhite
#000000black
Card foreground
#000000black
#ffffffwhite
Popover
#fbf8fcghostwhite
#000000black
Popover foreground
#000000black
#ffffffwhite
Primary
#000000black
#ffffffwhite
Primary foreground
#ffffffwhite
#000000black
Secondary
#313131darkslategray
#4e4e4edarkslategray
Secondary foreground
#ffffffwhite
#ffffffwhite
Muted
#9e9e9edarkgray
#232323black
Muted foreground
#b3b3b3darkgray
#ffffffwhite
Accent
#000000black
#969696darkgray
Accent foreground
#ffffffwhite
#ffffffwhite
Destructive
#ff2000red
#d82c1fcrimson
Destructive foreground
#ffffffwhite
#ffffffwhite
Border
#e6e4e7gainsboro
#969696darkgray
Input
#e6e4e7gainsboro
#ffffffwhite
Ring
#000000black
#ffffffwhite

Contrast

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

Light mode
Text on background19.88:1AAA
Text on card19.88:1AAA
Primary button21.00:1AAA
Secondary button13.00:1AAA
Muted text1.28:1Fail
Accent21.00:1AAA
Destructive3.84:1AA Large
Dark mode
Text on background21.00:1AAA
Text on card21.00:1AAA
Primary button21.00:1AAA
Secondary button8.34:1AAA
Muted text15.78:1AAA
Accent2.94:1Fail
Destructive4.89:1AA

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.982 0.007 317.751);
  --foreground: oklch(0 0 0);
  --muted: oklch(0.698 0 198.435);
  --muted-foreground: oklch(0.767 0 171.254);
  --popover: oklch(0.982 0.007 317.751);
  --popover-foreground: oklch(0 0 0);
  --card: oklch(0.982 0.007 317.751);
  --card-foreground: oklch(0 0 0);
  --border: oklch(0.921 0.005 317.755);
  --input: oklch(0.921 0.005 317.755);
  --primary: oklch(0 0 0);
  --primary-foreground: oklch(1 0 180);
  --secondary: oklch(0.313 0 167.471);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0 0 0);
  --accent-foreground: oklch(1 0 180);
  --destructive: oklch(0.636 0.25 30.69);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0 0 0);
  --chart-1: oklch(0 0 0);
  --chart-2: oklch(0.313 0 167.471);
  --chart-3: oklch(0 0 0);
  --chart-4: oklch(0.343 0 180);
  --chart-5: oklch(0 0 0);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0 0 0);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.255 0 180);
  --muted-foreground: oklch(1 0 180);
  --popover: oklch(0 0 0);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0 0 0);
  --card-foreground: oklch(1 0 180);
  --border: oklch(0.672 0 180);
  --input: oklch(1 0 180);
  --primary: oklch(1 0 180);
  --primary-foreground: oklch(0 0 0);
  --secondary: oklch(0.423 0 180);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0.674 0 180);
  --accent-foreground: oklch(1 0 180);
  --destructive: oklch(0.573 0.209 29.385);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(1 0 180);
  --chart-1: oklch(1 0 180);
  --chart-2: oklch(0.423 0 180);
  --chart-3: oklch(0.674 0 180);
  --chart-4: oklch(0.451 0 190.305);
  --chart-5: oklch(1 0 180);
}