Algebra for shadcn/ui

Algebra is a shadcn/ui theme built around a muted deep green primary color (#162216) with muted deep red accents (#221616). The light mode uses a neutral background (#f8fcf8). Dark mode keeps the muted deep green primary (#162216) on a green-tinted background (#040b04).

Color palette

TokenLightDark
Background
#f8fcf8mintcream
#040b04black
Foreground
#061406black
#f9fbf9mintcream
Card
#f4faf5whitesmoke
#060f06black
Card foreground
#051005black
#fcfdfcwhite
Popover
#f4faf5whitesmoke
#060f06black
Popover foreground
#051005black
#fcfdfcwhite
Primary
#162216black
#162216black
Primary foreground
#a5c5a6darkgray
#a5c5a6darkgray
Secondary
#161622black
#161622black
Secondary foreground
#a6a5c5darkgray
#a6a5c5darkgray
Muted
#f0f0f4whitesmoke
#0b0b0fblack
Muted foreground
#4d4c67darkslategray
#9998b3darkgray
Accent
#221616black
#221616black
Accent foreground
#c5a6a5darkgray
#c5a6a5darkgray
Destructive
#b8340ffirebrick
#ef6039tomato
Destructive foreground
#ffffffwhite
#000000black
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#162216black
#162216black

Contrast

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

Light mode
Text on background18.23:1AAA
Text on card18.36:1AAA
Primary button8.72:1AAA
Secondary button7.51:1AAA
Muted text7.27:1AAA
Accent7.82:1AAA
Destructive5.95:1AA
Dark mode
Text on background19.12:1AAA
Text on card19.12:1AAA
Primary button8.72:1AAA
Secondary button7.51:1AAA
Muted text7.02:1AAA
Accent7.82:1AAA
Destructive6.41:1AA

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.987 0.007 146.483);
  --foreground: oklch(0.172 0.034 144.788);
  --muted: oklch(0.957 0.005 287.834);
  --muted-foreground: oklch(0.428 0.044 285.903);
  --popover: oklch(0.98 0.01 146.453);
  --popover-foreground: oklch(0.156 0.029 144.959);
  --card: oklch(0.98 0.01 146.453);
  --card-foreground: oklch(0.156 0.029 144.959);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.237 0.028 145.423);
  --primary-foreground: oklch(0.792 0.056 145.899);
  --secondary: oklch(0.206 0.024 285.579);
  --secondary-foreground: oklch(0.733 0.047 286.714);
  --accent: oklch(0.217 0.02 21.043);
  --accent-foreground: oklch(0.752 0.037 20.343);
  --destructive: oklch(0.522 0.175 34.842);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.237 0.028 145.423);
  --chart-1: oklch(0.237 0.028 145.423);
  --chart-2: oklch(0.206 0.024 285.579);
  --chart-3: oklch(0.217 0.02 21.043);
  --chart-4: oklch(0.234 0.03 285.356);
  --chart-5: oklch(0.239 0.032 145.277);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.138 0.022 145.319);
  --foreground: oklch(0.986 0.003 146.516);
  --muted: oklch(0.15 0.009 286.831);
  --muted-foreground: oklch(0.691 0.039 286.859);
  --popover: oklch(0.154 0.025 145.204);
  --popover-foreground: oklch(0.993 0.001 146.528);
  --card: oklch(0.154 0.025 145.204);
  --card-foreground: oklch(0.993 0.001 146.528);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.237 0.028 145.423);
  --primary-foreground: oklch(0.792 0.056 145.899);
  --secondary: oklch(0.206 0.024 285.579);
  --secondary-foreground: oklch(0.733 0.047 286.714);
  --accent: oklch(0.217 0.02 21.043);
  --accent-foreground: oklch(0.752 0.037 20.343);
  --destructive: oklch(0.667 0.184 36.148);
  --destructive-foreground: oklch(0 0 0);
  --ring: oklch(0.237 0.028 145.423);
  --chart-1: oklch(0.237 0.028 145.423);
  --chart-2: oklch(0.206 0.024 285.579);
  --chart-3: oklch(0.217 0.02 21.043);
  --chart-4: oklch(0.234 0.03 285.356);
  --chart-5: oklch(0.239 0.032 145.277);
}