Subroutine for shadcn/ui

Subroutine is a shadcn/ui theme built around a muted deep indigo primary color (#0f0d16) with muted deep violet accents (#130d16). The light mode uses a neutral background (#ffffff). Dark mode keeps the muted deep indigo primary (#0f0d16) on a neutral background (#020104).

Color palette

TokenLightDark
Background
#ffffffwhite
#020104black
Foreground
#030209black
#fcfcfdwhite
Card
#ffffffwhite
#020104black
Card foreground
#030209black
#fcfcfdwhite
Popover
#ffffffwhite
#020104black
Popover foreground
#030209black
#fcfcfdwhite
Primary
#0f0d16black
#0f0d16black
Primary foreground
#9c96c0darkgray
#9c96c0darkgray
Secondary
#0d1116black
#0d1116black
Secondary foreground
#96a5c0darkgray
#96a5c0darkgray
Muted
#eeeff1whitesmoke
#0e0f11black
Muted foreground
#4c525ddarkslategray
#a2a8b3darkgray
Accent
#130d16black
#130d16black
Accent foreground
#b196c0darkgray
#b196c0darkgray
Destructive
#85230fsaddlebrown
#d83818firebrick
Destructive foreground
#f9d4cdbisque
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#0f0d16black
#0f0d16black

Contrast

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

Light mode
Text on background20.65:1AAA
Text on card20.65:1AAA
Primary button6.90:1AA
Secondary button7.62:1AAA
Muted text6.84:1AA
Accent7.26:1AAA
Destructive6.84:1AA
Dark mode
Text on background20.30:1AAA
Text on card20.30:1AAA
Primary button6.90:1AA
Secondary button7.62:1AAA
Muted text8.03:1AAA
Accent7.26:1AAA
Destructive4.67:1AA

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(1 0 180);
  --foreground: oklch(0.091 0.027 290.708);
  --muted: oklch(0.952 0.003 263.048);
  --muted-foreground: oklch(0.436 0.02 262.914);
  --popover: oklch(1 0 180);
  --popover-foreground: oklch(0.091 0.027 290.708);
  --card: oklch(1 0 180);
  --card-foreground: oklch(0.091 0.027 290.708);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.167 0.019 291.122);
  --primary-foreground: oklch(0.693 0.061 291.585);
  --secondary: oklch(0.175 0.013 262.761);
  --secondary-foreground: oklch(0.718 0.043 262.84);
  --accent: oklch(0.173 0.02 313.568);
  --accent-foreground: oklch(0.711 0.067 313.698);
  --destructive: oklch(0.412 0.137 33.048);
  --destructive-foreground: oklch(0.899 0.043 31.214);
  --ring: oklch(0.167 0.019 291.122);
  --chart-1: oklch(0.167 0.019 291.122);
  --chart-2: oklch(0.175 0.013 262.761);
  --chart-3: oklch(0.173 0.02 313.568);
  --chart-4: oklch(0.207 0.018 262.69);
  --chart-5: oklch(0.166 0.021 290.811);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.078 0.016 291.607);
  --foreground: oklch(0.992 0.001 293.293);
  --muted: oklch(0.167 0.005 262.976);
  --muted-foreground: oklch(0.731 0.017 262.997);
  --popover: oklch(0.078 0.016 291.607);
  --popover-foreground: oklch(0.992 0.001 293.293);
  --card: oklch(0.078 0.016 291.607);
  --card-foreground: oklch(0.992 0.001 293.293);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.167 0.019 291.122);
  --primary-foreground: oklch(0.693 0.061 291.585);
  --secondary: oklch(0.175 0.013 262.761);
  --secondary-foreground: oklch(0.718 0.043 262.84);
  --accent: oklch(0.173 0.02 313.568);
  --accent-foreground: oklch(0.711 0.067 313.698);
  --destructive: oklch(0.582 0.201 32.861);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.167 0.019 291.122);
  --chart-1: oklch(0.167 0.019 291.122);
  --chart-2: oklch(0.175 0.013 262.761);
  --chart-3: oklch(0.173 0.02 313.568);
  --chart-4: oklch(0.207 0.018 262.69);
  --chart-5: oklch(0.166 0.021 290.811);
}