Granular for shadcn/ui

Granular is a shadcn/ui theme built around a deep red primary color (#661515) with neutral gray accents (#dddada). The light mode uses a neutral background (#fefbfb). Dark mode keeps the deep red primary (#661515) on a neutral background (#030202).

Color palette

TokenLightDark
Background
#fefbfbsnow
#030202black
Foreground
#130606black
#fbf9f9snow
Card
#fefbfbsnow
#030202black
Card foreground
#130606black
#fbf9f9snow
Popover
#fefbfbsnow
#030202black
Popover foreground
#130606black
#fbf9f9snow
Primary
#661515maroon
#661515maroon
Primary foreground
#f1bbbblightpink
#f1bbbblightpink
Secondary
#dddadagainsboro
#282525darkslategray
Secondary foreground
#454040darkslategray
#c2bdbdsilver
Muted
#f5eaealinen
#150a0ablack
Muted foreground
#4c4343darkslategray
#bcb3b3silver
Accent
#dddadagainsboro
#282525darkslategray
Accent foreground
#454040darkslategray
#c2bdbdsilver
Destructive
#bd3c05firebrick
#f96424tomato
Destructive foreground
#ffffffwhite
#000000black
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#661515maroon
#661515maroon

Contrast

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

Light mode
Text on background19.34:1AAA
Text on card19.34:1AAA
Primary button7.49:1AAA
Secondary button7.32:1AAA
Muted text8.16:1AAA
Accent7.32:1AAA
Destructive5.50:1AA
Dark mode
Text on background19.77:1AAA
Text on card19.77:1AAA
Primary button7.49:1AAA
Secondary button8.21:1AAA
Muted text9.49:1AAA
Accent8.21:1AAA
Destructive6.89:1AA

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.991 0.002 17.198);
  --foreground: oklch(0.146 0.024 20.445);
  --muted: oklch(0.946 0.012 17.362);
  --muted-foreground: oklch(0.392 0.012 17.663);
  --popover: oklch(0.991 0.002 17.198);
  --popover-foreground: oklch(0.146 0.024 20.445);
  --card: oklch(0.991 0.002 17.198);
  --card-foreground: oklch(0.146 0.024 20.445);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.337 0.114 25.801);
  --primary-foreground: oklch(0.841 0.062 18.469);
  --secondary: oklch(0.89 0.003 17.216);
  --secondary-foreground: oklch(0.375 0.007 17.482);
  --accent: oklch(0.89 0.003 17.216);
  --accent-foreground: oklch(0.375 0.007 17.482);
  --destructive: oklch(0.539 0.174 38.098);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.337 0.114 25.801);
  --chart-1: oklch(0.337 0.114 25.801);
  --chart-2: oklch(0.89 0.003 17.216);
  --chart-3: oklch(0.89 0.003 17.216);
  --chart-4: oklch(0.914 0.002 17.202);
  --chart-5: oklch(0.339 0.118 26.212);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.086 0.008 18.916);
  --foreground: oklch(0.983 0.002 17.196);
  --muted: oklch(0.16 0.019 19.374);
  --muted-foreground: oklch(0.775 0.01 17.367);
  --popover: oklch(0.086 0.008 18.916);
  --popover-foreground: oklch(0.983 0.002 17.196);
  --card: oklch(0.086 0.008 18.916);
  --card-foreground: oklch(0.983 0.002 17.196);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.337 0.114 25.801);
  --primary-foreground: oklch(0.841 0.062 18.469);
  --secondary: oklch(0.267 0.005 17.444);
  --secondary-foreground: oklch(0.802 0.006 17.276);
  --accent: oklch(0.267 0.005 17.444);
  --accent-foreground: oklch(0.802 0.006 17.276);
  --destructive: oklch(0.686 0.196 40.523);
  --destructive-foreground: oklch(0 0 0);
  --ring: oklch(0.337 0.114 25.801);
  --chart-1: oklch(0.337 0.114 25.801);
  --chart-2: oklch(0.267 0.005 17.444);
  --chart-3: oklch(0.267 0.005 17.444);
  --chart-4: oklch(0.297 0.005 17.458);
  --chart-5: oklch(0.339 0.118 26.212);
}