freeCodeCamp Dark Theme for shadcn/ui

freeCodeCamp Dark Theme is a shadcn/ui theme built around a near-white primary color (#ffffff) with muted indigo accents (#49496f). The light mode uses an indigo-tinted background (#2a2a41). Dark mode keeps the near-white primary (#ffffff) on an indigo-tinted background (#2a2a41).

Color palette

TokenLightDark
Background
#2a2a41darkslategray
#2a2a41darkslategray
Foreground
#dfdfe2gainsboro
#dfdfe2gainsboro
Card
#26263bdarkslategray
#26263bdarkslategray
Card foreground
#ececeewhitesmoke
#ececeewhitesmoke
Popover
#242438darkslategray
#242438darkslategray
Popover foreground
#fafafasnow
#fafafasnow
Primary
#ffffffwhite
#ffffffwhite
Primary foreground
#333333darkslategray
#333333darkslategray
Secondary
#404040darkslategray
#404040darkslategray
Secondary foreground
#d9d9d9gainsboro
#d9d9d9gainsboro
Muted
#383847darkslategray
#383847darkslategray
Muted foreground
#b8b8c7silver
#b8b8c7silver
Accent
#49496fdarkslateblue
#49496fdarkslateblue
Accent foreground
#f3f3f7whitesmoke
#f3f3f7whitesmoke
Destructive
#f63123orangered
#f63123orangered
Destructive foreground
#ffffffwhite
#ffffffwhite
Border
#3b3b4adarkslategray
#3b3b4adarkslategray
Input
#424252darkslategray
#424252darkslategray
Ring
#ffffffwhite
#ffffffwhite

Contrast

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

Light mode
Text on background10.44:1AAA
Text on card12.47:1AAA
Primary button12.63:1AAA
Secondary button7.37:1AAA
Muted text5.86:1AA
Accent7.74:1AAA
Destructive3.90:1AA Large
Dark mode
Text on background10.44:1AAA
Text on card12.47:1AAA
Primary button12.63:1AAA
Secondary button7.37:1AAA
Muted text5.86:1AA
Accent7.74:1AAA
Destructive3.90:1AA Large

CSS variables

Paste this into your globals.css to use freeCodeCamp Dark Theme in your shadcn/ui project.

:root {
  --radius: 0.5rem;
  --background: oklch(0.297 0.041 283.654);
  --foreground: oklch(0.904 0.004 286.317);
  --muted: oklch(0.347 0.027 284.937);
  --muted-foreground: oklch(0.786 0.021 285.895);
  --popover: oklch(0.271 0.036 283.768);
  --popover-foreground: oklch(0.984 0.001 286.387);
  --card: oklch(0.28 0.037 283.728);
  --card-foreground: oklch(0.944 0.002 286.354);
  --border: oklch(0.358 0.025 285.065);
  --input: oklch(0.385 0.027 285.037);
  --primary: oklch(1 0 180);
  --primary-foreground: oklch(0.321 0 180);
  --secondary: oklch(0.371 0 168.69);
  --secondary-foreground: oklch(0.885 0 180);
  --accent: oklch(0.421 0.064 283.323);
  --accent-foreground: oklch(0.964 0.006 286.292);
  --destructive: oklch(0.63 0.232 29.463);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(1 0 180);
  --chart-1: oklch(1 0 180);
  --chart-2: oklch(0.371 0 168.69);
  --chart-3: oklch(0.421 0.064 283.323);
  --chart-4: oklch(0.399 0 180);
  --chart-5: oklch(1 0 180);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.297 0.041 283.654);
  --foreground: oklch(0.904 0.004 286.317);
  --muted: oklch(0.347 0.027 284.937);
  --muted-foreground: oklch(0.786 0.021 285.895);
  --popover: oklch(0.271 0.036 283.768);
  --popover-foreground: oklch(0.984 0.001 286.387);
  --card: oklch(0.28 0.037 283.728);
  --card-foreground: oklch(0.944 0.002 286.354);
  --border: oklch(0.358 0.025 285.065);
  --input: oklch(0.385 0.027 285.037);
  --primary: oklch(1 0 180);
  --primary-foreground: oklch(0.321 0 180);
  --secondary: oklch(0.371 0 168.69);
  --secondary-foreground: oklch(0.885 0 180);
  --accent: oklch(0.421 0.064 283.323);
  --accent-foreground: oklch(0.964 0.006 286.292);
  --destructive: oklch(0.63 0.232 29.463);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(1 0 180);
  --chart-1: oklch(1 0 180);
  --chart-2: oklch(0.371 0 168.69);
  --chart-3: oklch(0.421 0.064 283.323);
  --chart-4: oklch(0.399 0 180);
  --chart-5: oklch(1 0 180);
}