Twilight for shadcn/ui

Twilight is a shadcn/ui theme built around an indigo primary color (#5646c8) with green accents (#b9c846). The light mode uses a neutral background (#fbfbfe). Dark mode keeps the indigo primary (#5646c8) on an indigo-tinted background (#060510).

Color palette

TokenLightDark
Background
#fbfbfeghostwhite
#060510black
Foreground
#060416black
#f9f8fbghostwhite
Card
#f7f6fdghostwhite
#070614black
Card foreground
#050312black
#fcfcfdwhite
Popover
#f7f6fdghostwhite
#070614black
Popover foreground
#050312black
#fcfcfdwhite
Primary
#5646c8slateblue
#5646c8slateblue
Primary foreground
#ffffffwhite
#ffffffwhite
Secondary
#b9c846yellowgreen
#b9c846yellowgreen
Secondary foreground
#2f330fdarkgreen
#2f330fdarkgreen
Muted
#e7e7e4gainsboro
#1b1b18black
Muted foreground
#494a3fdarkslategray
#bec0b5silver
Accent
#b9c846yellowgreen
#b9c846yellowgreen
Accent foreground
#2f330fdarkgreen
#2f330fdarkgreen
Destructive
#c01b02firebrick
#fd3a1corangered
Destructive foreground
#ffffffwhite
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#5646c8slateblue
#5646c8slateblue

Contrast

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

Light mode
Text on background19.58:1AAA
Text on card19.08:1AAA
Primary button6.75:1AA
Secondary button7.11:1AAA
Muted text7.27:1AAA
Accent7.11:1AAA
Destructive6.18:1AA
Dark mode
Text on background19.17:1AAA
Text on card19.61:1AAA
Primary button6.75:1AA
Secondary button7.11:1AAA
Muted text9.35:1AAA
Accent7.11:1AAA
Destructive3.63:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.989 0.005 291.692);
  --foreground: oklch(0.124 0.043 285.853);
  --muted: oklch(0.928 0.005 111.877);
  --muted-foreground: oklch(0.406 0.018 112.603);
  --popover: oklch(0.977 0.009 291.601);
  --popover-foreground: oklch(0.114 0.038 286.931);
  --card: oklch(0.977 0.009 291.601);
  --card-foreground: oklch(0.114 0.038 286.931);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.49 0.192 281.919);
  --primary-foreground: oklch(1 0 180);
  --secondary: oklch(0.796 0.152 115.626);
  --secondary-foreground: oklch(0.308 0.055 115.284);
  --accent: oklch(0.796 0.152 115.626);
  --accent-foreground: oklch(0.308 0.055 115.284);
  --destructive: oklch(0.517 0.199 31.176);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.49 0.192 281.919);
  --chart-1: oklch(0.49 0.192 281.919);
  --chart-2: oklch(0.796 0.152 115.626);
  --chart-3: oklch(0.796 0.152 115.626);
  --chart-4: oklch(0.809 0.146 115.329);
  --chart-5: oklch(0.486 0.202 281.091);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.123 0.028 288.698);
  --foreground: oklch(0.982 0.004 291.707);
  --muted: oklch(0.222 0.007 112.352);
  --muted-foreground: oklch(0.803 0.015 112.135);
  --popover: oklch(0.133 0.032 287.808);
  --popover-foreground: oklch(0.991 0.002 291.744);
  --card: oklch(0.133 0.032 287.808);
  --card-foreground: oklch(0.991 0.002 291.744);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.49 0.192 281.919);
  --primary-foreground: oklch(1 0 180);
  --secondary: oklch(0.796 0.152 115.626);
  --secondary-foreground: oklch(0.308 0.055 115.284);
  --accent: oklch(0.796 0.152 115.626);
  --accent-foreground: oklch(0.308 0.055 115.284);
  --destructive: oklch(0.648 0.233 31.567);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.49 0.192 281.919);
  --chart-1: oklch(0.49 0.192 281.919);
  --chart-2: oklch(0.796 0.152 115.626);
  --chart-3: oklch(0.796 0.152 115.626);
  --chart-4: oklch(0.809 0.146 115.329);
  --chart-5: oklch(0.486 0.202 281.091);
}