Cobalt2 for shadcn/ui

Cobalt2 is a shadcn/ui theme built around a vivid yellow primary color (#ffc800) with blue accents (#2c5e81). The light mode uses a blue-tinted background (#193448). Dark mode keeps the vivid yellow primary (#ffc800) on a blue-tinted background (#193448).

Color palette

TokenLightDark
Background
#193448darkslategray
#193448darkslategray
Foreground
#ffffffwhite
#ffffffwhite
Card
#162f41darkslategray
#162f41darkslategray
Card foreground
#ffffffwhite
#ffffffwhite
Popover
#152c3ddarkslategray
#152c3ddarkslategray
Popover foreground
#ffffffwhite
#ffffffwhite
Primary
#ffc800gold
#ffc800gold
Primary foreground
#332800black
#332800black
Secondary
#534b2ddarkolivegreen
#534b2ddarkolivegreen
Secondary foreground
#e4dfcdgainsboro
#e4dfcdgainsboro
Muted
#343c42darkslategray
#343c42darkslategray
Muted foreground
#b2bcc2silver
#b2bcc2silver
Accent
#2c5e81darkslateblue
#2c5e81darkslateblue
Accent foreground
#e8f1f7lavender
#e8f1f7lavender
Destructive
#e6351aorangered
#e6351aorangered
Destructive foreground
#ffffffwhite
#ffffffwhite
Border
#254155darkslategray
#254155darkslategray
Input
#2a4960darkslategray
#2a4960darkslategray
Ring
#ffc800gold
#ffc800gold

Contrast

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

Light mode
Text on background12.85:1AAA
Text on card13.86:1AAA
Primary button9.34:1AAA
Secondary button6.55:1AA
Muted text5.82:1AA
Accent6.07:1AA
Destructive4.31:1AA Large
Dark mode
Text on background12.85:1AAA
Text on card13.86:1AAA
Primary button9.34:1AAA
Secondary button6.55:1AA
Muted text5.82:1AA
Accent6.07:1AA
Destructive4.31:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.315 0.049 241.683);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.35 0.015 239.002);
  --muted-foreground: oklch(0.788 0.015 238.626);
  --popover: oklch(0.283 0.043 241.496);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.294 0.045 241.563);
  --card-foreground: oklch(1 0 180);
  --border: oklch(0.363 0.048 240.951);
  --input: oklch(0.393 0.053 241.025);
  --primary: oklch(0.857 0.175 88.369);
  --primary-foreground: oklch(0.281 0.058 92.808);
  --secondary: oklch(0.412 0.047 94.462);
  --secondary-foreground: oklch(0.903 0.025 94.139);
  --accent: oklch(0.463 0.079 242.219);
  --accent-foreground: oklch(0.953 0.013 238.55);
  --destructive: oklch(0.603 0.216 31.587);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.857 0.175 88.369);
  --chart-1: oklch(0.857 0.175 88.369);
  --chart-2: oklch(0.412 0.047 94.462);
  --chart-3: oklch(0.463 0.079 242.219);
  --chart-4: oklch(0.445 0.051 94.455);
  --chart-5: oklch(0.865 0.177 88.019);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.315 0.049 241.683);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.35 0.015 239.002);
  --muted-foreground: oklch(0.788 0.015 238.626);
  --popover: oklch(0.283 0.043 241.496);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.294 0.045 241.563);
  --card-foreground: oklch(1 0 180);
  --border: oklch(0.363 0.048 240.951);
  --input: oklch(0.393 0.053 241.025);
  --primary: oklch(0.857 0.175 88.369);
  --primary-foreground: oklch(0.281 0.058 92.808);
  --secondary: oklch(0.412 0.047 94.462);
  --secondary-foreground: oklch(0.903 0.025 94.139);
  --accent: oklch(0.463 0.079 242.219);
  --accent-foreground: oklch(0.953 0.013 238.55);
  --destructive: oklch(0.603 0.216 31.587);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.857 0.175 88.369);
  --chart-1: oklch(0.857 0.175 88.369);
  --chart-2: oklch(0.412 0.047 94.462);
  --chart-3: oklch(0.463 0.079 242.219);
  --chart-4: oklch(0.445 0.051 94.455);
  --chart-5: oklch(0.865 0.177 88.019);
}