Sanity for shadcn/ui

Sanity is a shadcn/ui theme built around a muted purple primary color (#6c4b72) with muted green accents (#50724b). The light mode uses a neutral background (#fbf8fc). Dark mode keeps the muted purple primary (#6c4b72) on a neutral background (#070208).

Color palette

TokenLightDark
Background
#fbf8fcghostwhite
#070208black
Foreground
#0e0510black
#ffffffwhite
Card
#faf4fbghostwhite
#0b030cblack
Card foreground
#0b040cblack
#ffffffwhite
Popover
#faf4fbghostwhite
#0b030cblack
Popover foreground
#0b040cblack
#ffffffwhite
Primary
#6c4b72dimgray
#6c4b72dimgray
Primary foreground
#f8f6f9whitesmoke
#f8f6f9whitesmoke
Secondary
#50724bdarkolivegreen
#50724bdarkolivegreen
Secondary foreground
#ffffffwhite
#ffffffwhite
Muted
#d7e8d4gainsboro
#1a2b17black
Muted foreground
#3f473edarkslategray
#b9c1b8silver
Accent
#50724bdarkolivegreen
#50724bdarkolivegreen
Accent foreground
#ffffffwhite
#ffffffwhite
Destructive
#d5230bfirebrick
#f33920orangered
Destructive foreground
#ffffffwhite
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#6c4b72dimgray
#6c4b72dimgray

Contrast

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

Light mode
Text on background19.01:1AAA
Text on card18.70:1AAA
Primary button6.78:1AA
Secondary button5.44:1AA
Muted text7.49:1AAA
Accent5.44:1AA
Destructive5.15:1AA
Dark mode
Text on background20.55:1AAA
Text on card20.33:1AAA
Primary button6.78:1AA
Secondary button5.44:1AA
Muted text8.10:1AAA
Accent5.44:1AA
Destructive3.87:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.982 0.007 321.08);
  --foreground: oklch(0.136 0.031 322.014);
  --muted: oklch(0.912 0.032 140.988);
  --muted-foreground: oklch(0.387 0.019 140.961);
  --popover: oklch(0.974 0.01 321.088);
  --popover-foreground: oklch(0.123 0.027 322.575);
  --card: oklch(0.974 0.01 321.088);
  --card-foreground: oklch(0.123 0.027 322.575);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.463 0.075 321.368);
  --primary-foreground: oklch(0.975 0.005 321.077);
  --secondary: oklch(0.516 0.072 140.785);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0.516 0.072 140.785);
  --accent-foreground: oklch(1 0 180);
  --destructive: oklch(0.561 0.213 30.848);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.463 0.075 321.368);
  --chart-1: oklch(0.463 0.075 321.368);
  --chart-2: oklch(0.516 0.072 140.785);
  --chart-3: oklch(0.516 0.072 140.785);
  --chart-4: oklch(0.545 0.077 140.784);
  --chart-5: oklch(0.462 0.085 321.396);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.106 0.026 323.028);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.268 0.042 140.761);
  --muted-foreground: oklch(0.803 0.016 141.023);
  --popover: oklch(0.122 0.03 322.704);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.122 0.03 322.704);
  --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.463 0.075 321.368);
  --primary-foreground: oklch(0.975 0.005 321.077);
  --secondary: oklch(0.516 0.072 140.785);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0.516 0.072 140.785);
  --accent-foreground: oklch(1 0 180);
  --destructive: oklch(0.631 0.225 31.041);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.463 0.075 321.368);
  --chart-1: oklch(0.463 0.075 321.368);
  --chart-2: oklch(0.516 0.072 140.785);
  --chart-3: oklch(0.516 0.072 140.785);
  --chart-4: oklch(0.545 0.077 140.784);
  --chart-5: oklch(0.462 0.085 321.396);
}