Purple for shadcn/ui

Purple is a shadcn/ui theme built around a violet primary color (#551ba7) with green accents (#6da71b). The light mode uses a neutral background (#fcfbfe). Dark mode keeps the violet primary (#551ba7) on a neutral background (#000000).

Color palette

TokenLightDark
Background
#fcfbfewhite
#000000black
Foreground
#07030dblack
#f7f6f9whitesmoke
Card
#f9f7fdghostwhite
#030303black
Card foreground
#050209black
#faf9fbghostwhite
Popover
#f9f7fdghostwhite
#030303black
Popover foreground
#050209black
#faf9fbghostwhite
Primary
#551ba7rebeccapurple
#551ba7rebeccapurple
Primary foreground
#f9f6feghostwhite
#f9f6feghostwhite
Secondary
#6da71bolivedrab
#6da71bolivedrab
Secondary foreground
#000000black
#000000black
Muted
#e4e9ddgainsboro
#1d2216black
Muted foreground
#4b4e46darkslategray
#b6b9b1silver
Accent
#6da71bolivedrab
#6da71bolivedrab
Accent foreground
#000000black
#000000black
Destructive
#b93404firebrick
#e13f05orangered
Destructive foreground
#ffffffwhite
#ffffffwhite
Border
#e8e6eblavender
#1e1b22black
Input
#e8e6eblavender
#1e1b22black
Ring
#551ba7rebeccapurple
#551ba7rebeccapurple

Contrast

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

Light mode
Text on background19.80:1AAA
Text on card19.35:1AAA
Primary button9.34:1AAA
Secondary button7.16:1AAA
Muted text6.84:1AA
Accent7.16:1AAA
Destructive5.90:1AA
Dark mode
Text on background19.50:1AAA
Text on card19.70:1AAA
Primary button9.34:1AAA
Secondary button7.16:1AAA
Muted text8.19:1AAA
Accent7.16:1AAA
Destructive4.26:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.989 0.005 304.982);
  --foreground: oklch(0.112 0.031 306.106);
  --muted: oklch(0.926 0.016 125.282);
  --muted-foreground: oklch(0.419 0.015 125.552);
  --popover: oklch(0.979 0.009 304.917);
  --popover-foreground: oklch(0.097 0.027 306.53);
  --card: oklch(0.979 0.009 304.917);
  --card-foreground: oklch(0.097 0.027 306.53);
  --border: oklch(0.927 0.007 304.939);
  --input: oklch(0.927 0.007 304.939);
  --primary: oklch(0.406 0.199 294.202);
  --primary-foreground: oklch(0.978 0.01 304.901);
  --secondary: oklch(0.662 0.171 130.848);
  --secondary-foreground: oklch(0 0 0);
  --accent: oklch(0.662 0.171 130.848);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.523 0.176 36.224);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.406 0.199 294.202);
  --chart-1: oklch(0.406 0.199 294.202);
  --chart-2: oklch(0.662 0.171 130.848);
  --chart-3: oklch(0.662 0.171 130.848);
  --chart-4: oklch(0.7 0.182 130.902);
  --chart-5: oklch(0.406 0.204 293.513);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0 0 0);
  --foreground: oklch(0.975 0.003 304.997);
  --muted: oklch(0.242 0.022 126.344);
  --muted-foreground: oklch(0.782 0.013 125.277);
  --popover: oklch(0.092 0 180);
  --popover-foreground: oklch(0.983 0.002 305.013);
  --card: oklch(0.092 0 180);
  --card-foreground: oklch(0.983 0.002 305.013);
  --border: oklch(0.229 0.013 304.234);
  --input: oklch(0.229 0.013 304.234);
  --primary: oklch(0.406 0.199 294.202);
  --primary-foreground: oklch(0.978 0.01 304.901);
  --secondary: oklch(0.662 0.171 130.848);
  --secondary-foreground: oklch(0 0 0);
  --accent: oklch(0.662 0.171 130.848);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.604 0.206 35.853);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.406 0.199 294.202);
  --chart-1: oklch(0.406 0.199 294.202);
  --chart-2: oklch(0.662 0.171 130.848);
  --chart-3: oklch(0.662 0.171 130.848);
  --chart-4: oklch(0.7 0.182 130.902);
  --chart-5: oklch(0.406 0.204 293.513);
}