Contrast for shadcn/ui

Contrast is a shadcn/ui theme built around a teal primary color (#407776) with red accents (#774042). The light mode uses a neutral background (#f8fcfc). Dark mode keeps the teal primary (#407776) on a neutral background (#030707).

Color palette

TokenLightDark
Background
#f8fcfcmintcream
#030707black
Foreground
#021212black
#f5fafamintcream
Card
#f4fbfbmintcream
#040b0bblack
Card foreground
#020e0dblack
#f8fcfbmintcream
Popover
#f8fcfcmintcream
#030707black
Popover foreground
#021212black
#f5fafamintcream
Primary
#407776seagreen
#407776seagreen
Primary foreground
#ffffffwhite
#ffffffwhite
Secondary
#774042sienna
#774042sienna
Secondary foreground
#f8f2f2whitesmoke
#f8f2f2whitesmoke
Muted
#ebd1d2gainsboro
#2e1415black
Muted foreground
#6b5758dimgray
#a89495rosybrown
Accent
#774042sienna
#774042sienna
Accent foreground
#f8f2f2whitesmoke
#f8f2f2whitesmoke
Destructive
#7e2301maroon
#fd5417orangered
Destructive foreground
#fec7b3peachpuff
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#407776seagreen
#407776seagreen

Contrast

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

Light mode
Text on background18.52:1AAA
Text on card18.68:1AAA
Primary button5.07:1AA
Secondary button7.27:1AAA
Muted text4.65:1AA
Accent7.27:1AAA
Destructive6.59:1AA
Dark mode
Text on background19.20:1AAA
Text on card19.20:1AAA
Primary button5.07:1AA
Secondary button7.27:1AAA
Muted text5.96:1AA
Accent7.27:1AAA
Destructive3.25:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.988 0.005 194.696);
  --foreground: oklch(0.167 0.024 192.495);
  --muted: oklch(0.882 0.029 15.415);
  --muted-foreground: oklch(0.477 0.026 15.826);
  --popover: oklch(0.988 0.005 194.696);
  --popover-foreground: oklch(0.167 0.024 192.495);
  --card: oklch(0.982 0.007 194.649);
  --card-foreground: oklch(0.148 0.021 192.823);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.532 0.059 192.735);
  --primary-foreground: oklch(1 0 180);
  --secondary: oklch(0.441 0.077 18.548);
  --secondary-foreground: oklch(0.965 0.007 14.918);
  --accent: oklch(0.441 0.077 18.548);
  --accent-foreground: oklch(0.965 0.007 14.918);
  --destructive: oklch(0.398 0.132 37.143);
  --destructive-foreground: oklch(0.874 0.069 40.907);
  --ring: oklch(0.532 0.059 192.735);
  --chart-1: oklch(0.532 0.059 192.735);
  --chart-2: oklch(0.441 0.077 18.548);
  --chart-3: oklch(0.441 0.077 18.548);
  --chart-4: oklch(0.466 0.082 18.597);
  --chart-5: oklch(0.539 0.063 192.591);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.123 0.011 193.749);
  --foreground: oklch(0.981 0.005 194.691);
  --muted: oklch(0.231 0.042 18.804);
  --muted-foreground: oklch(0.685 0.023 15.433);
  --popover: oklch(0.123 0.011 193.749);
  --popover-foreground: oklch(0.981 0.005 194.691);
  --card: oklch(0.141 0.012 193.663);
  --card-foreground: oklch(0.987 0.003 194.724);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.532 0.059 192.735);
  --primary-foreground: oklch(1 0 180);
  --secondary: oklch(0.441 0.077 18.548);
  --secondary-foreground: oklch(0.965 0.007 14.918);
  --accent: oklch(0.441 0.077 18.548);
  --accent-foreground: oklch(0.965 0.007 14.918);
  --destructive: oklch(0.672 0.214 37.28);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.532 0.059 192.735);
  --chart-1: oklch(0.532 0.059 192.735);
  --chart-2: oklch(0.441 0.077 18.548);
  --chart-3: oklch(0.441 0.077 18.548);
  --chart-4: oklch(0.466 0.082 18.597);
  --chart-5: oklch(0.539 0.063 192.591);
}