Algorithm for shadcn/ui

Algorithm is a shadcn/ui theme built around a blue primary color (#4e65da) with green accents (#65da4e). The light mode uses a neutral background (#f8f8fc). Dark mode keeps the blue primary (#4e65da) on a neutral background (#020308).

Color palette

TokenLightDark
Background
#f8f8fcghostwhite
#020308black
Foreground
#030611black
#f5f6fawhitesmoke
Card
#f4f5fbwhitesmoke
#03050cblack
Card foreground
#02040dblack
#f8f9fcghostwhite
Popover
#f4f5fbwhitesmoke
#03050cblack
Popover foreground
#02040dblack
#f8f9fcghostwhite
Primary
#4e65daroyalblue
#4e65daroyalblue
Primary foreground
#ffffffwhite
#ffffffwhite
Secondary
#da4e65indianred
#da4e65indianred
Secondary foreground
#ffffffwhite
#ffffffwhite
Muted
#e6d1d4gainsboro
#2e191dblack
Muted foreground
#464344darkslategray
#bcb9b9silver
Accent
#65da4elimegreen
#65da4elimegreen
Accent foreground
#000000black
#000000black
Destructive
#771a0dmaroon
#e6311aorangered
Destructive foreground
#f8c5bfpink
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#4e65daroyalblue
#4e65daroyalblue

Contrast

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

Light mode
Text on background19.14:1AAA
Text on card18.83:1AAA
Primary button4.98:1AA
Secondary button3.99:1AA Large
Muted text6.71:1AA
Accent11.64:1AAA
Destructive7.07:1AAA
Dark mode
Text on background19.07:1AAA
Text on card19.37:1AAA
Primary button4.98:1AA
Secondary button3.99:1AA Large
Muted text8.44:1AAA
Accent11.64:1AAA
Destructive4.36:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.981 0.005 277.191);
  --foreground: oklch(0.123 0.029 268.914);
  --muted: oklch(0.878 0.023 6.135);
  --muted-foreground: oklch(0.388 0.004 5.702);
  --popover: oklch(0.971 0.007 277.154);
  --popover-foreground: oklch(0.111 0.025 268.335);
  --card: oklch(0.971 0.007 277.154);
  --card-foreground: oklch(0.111 0.025 268.335);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.554 0.179 270.934);
  --primary-foreground: oklch(1 0 180);
  --secondary: oklch(0.619 0.174 13.913);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0.791 0.207 140.508);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.376 0.13 31.015);
  --destructive-foreground: oklch(0.867 0.059 27.039);
  --ring: oklch(0.554 0.179 270.934);
  --chart-1: oklch(0.554 0.179 270.934);
  --chart-2: oklch(0.619 0.174 13.913);
  --chart-3: oklch(0.791 0.207 140.508);
  --chart-4: oklch(0.641 0.162 12.733);
  --chart-5: oklch(0.551 0.187 270.545);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.1 0.018 269.895);
  --foreground: oklch(0.972 0.006 277.174);
  --muted: oklch(0.244 0.034 9.002);
  --muted-foreground: oklch(0.787 0.003 5.553);
  --popover: oklch(0.114 0.021 270.018);
  --popover-foreground: oklch(0.982 0.004 277.204);
  --card: oklch(0.114 0.021 270.018);
  --card-foreground: oklch(0.982 0.004 277.204);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.554 0.179 270.934);
  --primary-foreground: oklch(1 0 180);
  --secondary: oklch(0.619 0.174 13.913);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0.791 0.207 140.508);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.601 0.218 31.03);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.554 0.179 270.934);
  --chart-1: oklch(0.554 0.179 270.934);
  --chart-2: oklch(0.619 0.174 13.913);
  --chart-3: oklch(0.791 0.207 140.508);
  --chart-4: oklch(0.641 0.162 12.733);
  --chart-5: oklch(0.551 0.187 270.545);
}