Grain for shadcn/ui

Grain is a shadcn/ui theme built around a vivid red primary color (#f27897) with muted light red accents (#e7dfe1). The light mode uses a neutral background (#fcf8f9). Dark mode keeps the vivid red primary (#f27897) on a red-tinted background (#0a0506).

Color palette

TokenLightDark
Background
#fcf8f9snow
#0a0506black
Foreground
#110307black
#fbf9f9snow
Card
#fbf4f6lavenderblush
#0e0708black
Card foreground
#0d0305black
#fdfcfcsnow
Popover
#fcf8f9snow
#0a0506black
Popover foreground
#110307black
#fbf9f9snow
Primary
#f27897lightcoral
#f27897lightcoral
Primary foreground
#330511black
#330511black
Secondary
#e7dfe1gainsboro
#372a2ddarkslategray
Secondary foreground
#544045darkslategray
#d0c2c6silver
Muted
#dcd6d7gainsboro
#292325darkslategray
Muted foreground
#6d5a5edimgray
#a59297rosybrown
Accent
#e7dfe1gainsboro
#372a2ddarkslategray
Accent foreground
#544045darkslategray
#d0c2c6silver
Destructive
#af0404darkred
#fb2828crimson
Destructive foreground
#fee6e6mistyrose
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#f27897lightcoral
#f27897lightcoral

Contrast

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

Light mode
Text on background19.13:1AAA
Text on card18.75:1AAA
Primary button6.76:1AA
Secondary button7.30:1AAA
Muted text4.46:1AA Large
Accent7.30:1AAA
Destructive6.22:1AA
Dark mode
Text on background19.28:1AAA
Text on card19.50:1AAA
Primary button6.76:1AA
Secondary button7.96:1AAA
Muted text5.24:1AA
Accent7.96:1AAA
Destructive3.87:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.982 0.005 0.007);
  --foreground: oklch(0.131 0.031 1.572);
  --muted: oklch(0.88 0.007 0.091);
  --muted-foreground: oklch(0.487 0.027 1.388);
  --popover: oklch(0.982 0.005 0.007);
  --popover-foreground: oklch(0.131 0.031 1.572);
  --card: oklch(0.973 0.007 0.079);
  --card-foreground: oklch(0.118 0.027 0.149);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.721 0.151 5.812);
  --primary-foreground: oklch(0.214 0.073 11.063);
  --secondary: oklch(0.91 0.009 0.143);
  --secondary-foreground: oklch(0.394 0.03 1.932);
  --accent: oklch(0.91 0.009 0.143);
  --accent-foreground: oklch(0.394 0.03 1.932);
  --destructive: oklch(0.475 0.193 29.028);
  --destructive-foreground: oklch(0.945 0.027 17.637);
  --ring: oklch(0.721 0.151 5.812);
  --chart-1: oklch(0.721 0.151 5.812);
  --chart-2: oklch(0.91 0.009 0.143);
  --chart-3: oklch(0.91 0.009 0.143);
  --chart-4: oklch(0.935 0.006 0.061);
  --chart-5: oklch(0.721 0.157 6.064);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.125 0.012 359.824);
  --foreground: oklch(0.983 0.003 359.951);
  --muted: oklch(0.264 0.01 0.873);
  --muted-foreground: oklch(0.678 0.025 0.874);
  --popover: oklch(0.125 0.012 359.824);
  --popover-foreground: oklch(0.983 0.003 359.951);
  --card: oklch(0.138 0.014 0.743);
  --card-foreground: oklch(0.992 0.001 359.908);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.721 0.151 5.812);
  --primary-foreground: oklch(0.214 0.073 11.063);
  --secondary: oklch(0.301 0.019 1.625);
  --secondary-foreground: oklch(0.828 0.016 0.417);
  --accent: oklch(0.301 0.019 1.625);
  --accent-foreground: oklch(0.828 0.016 0.417);
  --destructive: oklch(0.634 0.24 27.63);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.721 0.151 5.812);
  --chart-1: oklch(0.721 0.151 5.812);
  --chart-2: oklch(0.301 0.019 1.625);
  --chart-3: oklch(0.301 0.019 1.625);
  --chart-4: oklch(0.33 0.022 1.683);
  --chart-5: oklch(0.721 0.157 6.064);
}