Altruistic for shadcn/ui

Altruistic is a shadcn/ui theme built around an indigo primary color (#241985) with green accents (#7a8519). The light mode uses a neutral background (#f8f7fd). Dark mode keeps the indigo primary (#241985) on a neutral background (#030307).

Color palette

TokenLightDark
Background
#f8f7fdghostwhite
#030307black
Foreground
#020109black
#ffffffwhite
Card
#f8f7fdghostwhite
#030307black
Card foreground
#020109black
#ffffffwhite
Popover
#f8f7fdghostwhite
#030307black
Popover foreground
#020109black
#ffffffwhite
Primary
#241985midnightblue
#241985midnightblue
Primary foreground
#dcd8f8lavender
#dcd8f8lavender
Secondary
#7a8519olivedrab
#7a8519olivedrab
Secondary foreground
#ffffffwhite
#ffffffwhite
Muted
#f5f6eewhitesmoke
#101109black
Muted foreground
#494a40darkslategray
#bebfb5silver
Accent
#7a8519olivedrab
#7a8519olivedrab
Accent foreground
#ffffffwhite
#ffffffwhite
Destructive
#700601maroon
#fe2b20orangered
Destructive foreground
#ffa8a4lightpink
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#241985midnightblue
#241985midnightblue

Contrast

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

Light mode
Text on background19.51:1AAA
Text on card19.51:1AAA
Primary button9.79:1AAA
Secondary button4.04:1AA Large
Muted text8.26:1AAA
Accent4.04:1AA Large
Destructive6.65:1AA
Dark mode
Text on background20.60:1AAA
Text on card20.60:1AAA
Primary button9.79:1AAA
Secondary button4.04:1AA Large
Muted text10.25:1AAA
Accent4.04:1AA Large
Destructive3.76:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.979 0.007 290.876);
  --foreground: oklch(0.087 0.03 286.471);
  --muted: oklch(0.971 0.01 111.209);
  --muted-foreground: oklch(0.404 0.016 111.737);
  --popover: oklch(0.979 0.007 290.876);
  --popover-foreground: oklch(0.087 0.03 286.471);
  --card: oklch(0.979 0.007 290.876);
  --card-foreground: oklch(0.087 0.03 286.471);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.32 0.167 275.797);
  --primary-foreground: oklch(0.896 0.043 290.1);
  --secondary: oklch(0.588 0.125 115.501);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0.588 0.125 115.501);
  --accent-foreground: oklch(1 0 180);
  --destructive: oklch(0.345 0.137 30.205);
  --destructive-foreground: oklch(0.816 0.103 22.868);
  --ring: oklch(0.32 0.167 275.797);
  --chart-1: oklch(0.32 0.167 275.797);
  --chart-2: oklch(0.588 0.125 115.501);
  --chart-3: oklch(0.588 0.125 115.501);
  --chart-4: oklch(0.628 0.134 115.539);
  --chart-5: oklch(0.319 0.173 274.838);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.1 0.017 288.941);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.172 0.015 112.617);
  --muted-foreground: oklch(0.801 0.013 111.326);
  --popover: oklch(0.1 0.017 288.941);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.1 0.017 288.941);
  --card-foreground: oklch(1 0 180);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.32 0.167 275.797);
  --primary-foreground: oklch(0.896 0.043 290.1);
  --secondary: oklch(0.588 0.125 115.501);
  --secondary-foreground: oklch(1 0 180);
  --accent: oklch(0.588 0.125 115.501);
  --accent-foreground: oklch(1 0 180);
  --destructive: oklch(0.64 0.242 29.158);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.32 0.167 275.797);
  --chart-1: oklch(0.32 0.167 275.797);
  --chart-2: oklch(0.588 0.125 115.501);
  --chart-3: oklch(0.588 0.125 115.501);
  --chart-4: oklch(0.628 0.134 115.539);
  --chart-5: oklch(0.319 0.173 274.838);
}