Contrast for shadcn/ui

Contrast is a shadcn/ui theme built around a vivid pink primary color (#cb1052) with muted light pink accents (#d8c5cc). The light mode uses a neutral background (#fdf6f9). Dark mode keeps the vivid pink primary (#cb1052) on a pink-tinted background (#0b0507).

Color palette

TokenLightDark
Background
#fdf6f9snow
#0b0507black
Foreground
#040102black
#faf5f7whitesmoke
Card
#fdf2f6lavenderblush
#0e0609black
Card foreground
#000000black
#fcf8f9snow
Popover
#fdf6f9snow
#0b0507black
Popover foreground
#040102black
#faf5f7whitesmoke
Primary
#cb1052crimson
#cb1052crimson
Primary foreground
#ffffffwhite
#ffffffwhite
Secondary
#d8c5ccthistle
#1e1a1cblack
Secondary foreground
#402b32darkslategray
#b9b1b4silver
Muted
#eee7ealinen
#181113black
Muted foreground
#6d545ddimgray
#ab929arosybrown
Accent
#d8c5ccthistle
#1e1a1cblack
Accent foreground
#402b32darkslategray
#b9b1b4silver
Destructive
#6b0f05maroon
#f42710orangered
Destructive foreground
#fbb0a7lightpink
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#cb1052crimson
#cb1052crimson

Contrast

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

Light mode
Text on background19.57:1AAA
Text on card19.19:1AAA
Primary button5.62:1AA
Secondary button7.95:1AAA
Muted text5.61:1AA
Accent7.95:1AAA
Destructive6.98:1AA
Dark mode
Text on background18.77:1AAA
Text on card18.98:1AAA
Primary button5.62:1AA
Secondary button8.19:1AAA
Muted text6.48:1AA
Accent8.19:1AAA
Destructive4.08: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.98 0.008 353.817);
  --foreground: oklch(0.084 0.015 353.216);
  --muted: oklch(0.934 0.008 353.824);
  --muted-foreground: oklch(0.476 0.036 355.646);
  --popover: oklch(0.98 0.008 353.817);
  --popover-foreground: oklch(0.084 0.015 353.216);
  --card: oklch(0.971 0.012 353.942);
  --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.542 0.21 10.426);
  --primary-foreground: oklch(1 0 180);
  --secondary: oklch(0.842 0.022 354.327);
  --secondary-foreground: oklch(0.317 0.032 356.34);
  --accent: oklch(0.842 0.022 354.327);
  --accent-foreground: oklch(0.317 0.032 356.34);
  --destructive: oklch(0.342 0.126 30.768);
  --destructive-foreground: oklch(0.825 0.09 26.236);
  --ring: oklch(0.542 0.21 10.426);
  --chart-1: oklch(0.542 0.21 10.426);
  --chart-2: oklch(0.842 0.022 354.327);
  --chart-3: oklch(0.842 0.022 354.327);
  --chart-4: oklch(0.867 0.019 354.186);
  --chart-5: oklch(0.547 0.214 11.141);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.125 0.014 353.36);
  --foreground: oklch(0.974 0.006 353.763);
  --muted: oklch(0.187 0.012 355.407);
  --muted-foreground: oklch(0.684 0.032 354.9);
  --popover: oklch(0.125 0.014 353.36);
  --popover-foreground: oklch(0.974 0.006 353.763);
  --card: oklch(0.138 0.016 354.605);
  --card-foreground: oklch(0.982 0.004 353.699);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.542 0.21 10.426);
  --primary-foreground: oklch(1 0 180);
  --secondary: oklch(0.224 0.006 354.295);
  --secondary-foreground: oklch(0.767 0.011 353.983);
  --accent: oklch(0.224 0.006 354.295);
  --accent-foreground: oklch(0.767 0.011 353.983);
  --destructive: oklch(0.62 0.237 30.465);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.542 0.21 10.426);
  --chart-1: oklch(0.542 0.21 10.426);
  --chart-2: oklch(0.224 0.006 354.295);
  --chart-3: oklch(0.224 0.006 354.295);
  --chart-4: oklch(0.255 0.007 354.351);
  --chart-5: oklch(0.547 0.214 11.141);
}