Battery for shadcn/ui

Battery is a shadcn/ui theme built around a light violet primary color (#e2c9f3) with light purple accents (#f3c9ef). The light mode uses a neutral background (#faf8fc). Dark mode keeps the light violet primary (#e2c9f3) on a violet-tinted background (#08050a).

Color palette

TokenLightDark
Background
#faf8fcghostwhite
#08050ablack
Foreground
#0f0316black
#f8f5f9whitesmoke
Card
#f8f4fawhitesmoke
#0b070dblack
Card foreground
#0c0312black
#faf9fbghostwhite
Popover
#faf8fcghostwhite
#08050ablack
Popover foreground
#0f0316black
#f8f5f9whitesmoke
Primary
#e2c9f3lavender
#e2c9f3lavender
Primary foreground
#4e1971indigo
#4e1971indigo
Secondary
#cdc9f3thistle
#cdc9f3thistle
Secondary foreground
#221971midnightblue
#221971midnightblue
Muted
#e4e3e8gainsboro
#18171cblack
Muted foreground
#585766dimgray
#9b99a8darkgray
Accent
#f3c9efmistyrose
#f3c9efmistyrose
Accent foreground
#711968purple
#711968purple
Destructive
#6c1809maroon
#eb3919orangered
Destructive foreground
#f8baaflightpink
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#e2c9f3lavender
#e2c9f3lavender

Contrast

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

Light mode
Text on background19.04:1AAA
Text on card18.66:1AAA
Primary button8.14:1AAA
Secondary button9.13:1AAA
Muted text5.54:1AA
Accent7.04:1AAA
Destructive7.12:1AAA
Dark mode
Text on background18.70:1AAA
Text on card19.03:1AAA
Primary button8.14:1AAA
Secondary button9.13:1AAA
Muted text6.37:1AA
Accent7.04:1AAA
Destructive4.09:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.982 0.006 312.314);
  --foreground: oklch(0.138 0.046 311.337);
  --muted: oklch(0.918 0.006 290.887);
  --muted-foreground: oklch(0.463 0.024 290.003);
  --popover: oklch(0.982 0.006 312.314);
  --popover-foreground: oklch(0.138 0.046 311.337);
  --card: oklch(0.973 0.009 312.291);
  --card-foreground: oklch(0.126 0.04 312.59);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.869 0.064 311.815);
  --primary-foreground: oklch(0.345 0.144 307.734);
  --secondary: oklch(0.852 0.059 289.674);
  --secondary-foreground: oklch(0.295 0.143 277.522);
  --accent: oklch(0.883 0.069 329.424);
  --accent-foreground: oklch(0.393 0.151 332.55);
  --destructive: oklch(0.352 0.12 32.321);
  --destructive-foreground: oklch(0.843 0.074 30.036);
  --ring: oklch(0.869 0.064 311.815);
  --chart-1: oklch(0.869 0.064 311.815);
  --chart-2: oklch(0.852 0.059 289.674);
  --chart-3: oklch(0.883 0.069 329.424);
  --chart-4: oklch(0.886 0.045 290.044);
  --chart-5: oklch(0.868 0.067 311.789);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.125 0.013 313.278);
  --foreground: oklch(0.974 0.006 312.314);
  --muted: oklch(0.208 0.009 290.183);
  --muted-foreground: oklch(0.689 0.022 290.407);
  --popover: oklch(0.125 0.013 313.278);
  --popover-foreground: oklch(0.974 0.006 312.314);
  --card: oklch(0.138 0.015 312.277);
  --card-foreground: oklch(0.983 0.004 312.329);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.869 0.064 311.815);
  --primary-foreground: oklch(0.345 0.144 307.734);
  --secondary: oklch(0.852 0.059 289.674);
  --secondary-foreground: oklch(0.295 0.143 277.522);
  --accent: oklch(0.883 0.069 329.424);
  --accent-foreground: oklch(0.393 0.151 332.55);
  --destructive: oklch(0.616 0.218 32.159);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.869 0.064 311.815);
  --chart-1: oklch(0.869 0.064 311.815);
  --chart-2: oklch(0.852 0.059 289.674);
  --chart-3: oklch(0.883 0.069 329.424);
  --chart-4: oklch(0.886 0.045 290.044);
  --chart-5: oklch(0.868 0.067 311.789);
}