Rule for shadcn/ui

Rule is a shadcn/ui theme built around a near-white primary color (#f8f9fc) with near-white accents (#f9f8fc). The light mode uses a neutral background (#f7f9fd). Dark mode keeps the near-white primary (#f8f9fc) on a blue-tinted background (#07090e).

Color palette

TokenLightDark
Background
#f7f9fdghostwhite
#07090eblack
Foreground
#000000black
#ffffffwhite
Card
#f3f6fcaliceblue
#080c11black
Card foreground
#000000black
#ffffffwhite
Popover
#f7f9fdghostwhite
#07090eblack
Popover foreground
#000000black
#ffffffwhite
Primary
#f8f9fcghostwhite
#f8f9fcghostwhite
Primary foreground
#3f5983darkslateblue
#3f5983darkslateblue
Secondary
#f8fbfcghostwhite
#f8fbfcghostwhite
Secondary foreground
#1e3a3edarkslategray
#1e3a3edarkslategray
Muted
#e9f1f2whitesmoke
#0d1516black
Muted foreground
#525a5bdimgray
#a4acaddarkgray
Accent
#f9f8fcghostwhite
#f9f8fcghostwhite
Accent foreground
#473f83darkslateblue
#473f83darkslateblue
Destructive
#91230dsaddlebrown
#ea411forangered
Destructive foreground
#fbdbd5mistyrose
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#f8f9fcghostwhite
#f8f9fcghostwhite

Contrast

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

Light mode
Text on background19.93:1AAA
Text on card19.41:1AAA
Primary button6.74:1AA
Secondary button11.69:1AAA
Muted text6.14:1AA
Accent8.60:1AAA
Destructive6.61:1AA
Dark mode
Text on background19.89:1AAA
Text on card19.61:1AAA
Primary button6.74:1AA
Secondary button11.69:1AAA
Muted text7.96:1AAA
Accent8.60:1AAA
Destructive3.97:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.982 0.006 259.94);
  --foreground: oklch(0 0 0);
  --muted: oklch(0.951 0.009 206.386);
  --muted-foreground: oklch(0.461 0.01 206.328);
  --popover: oklch(0.982 0.006 259.94);
  --popover-foreground: oklch(0 0 0);
  --card: oklch(0.973 0.009 259.943);
  --card-foreground: oklch(0 0 0);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.983 0.003 259.938);
  --primary-foreground: oklch(0.462 0.076 259.606);
  --secondary: oklch(0.987 0.003 206.42);
  --secondary-foreground: oklch(0.329 0.035 206.543);
  --accent: oklch(0.981 0.005 291.689);
  --accent-foreground: oklch(0.411 0.11 285.822);
  --destructive: oklch(0.434 0.148 32.915);
  --destructive-foreground: oklch(0.917 0.036 31.17);
  --ring: oklch(0.983 0.003 259.938);
  --chart-1: oklch(0.983 0.003 259.938);
  --chart-2: oklch(0.987 0.003 206.42);
  --chart-3: oklch(0.981 0.005 291.689);
  --chart-4: oklch(1.007 0.002 26.452);
  --chart-5: oklch(0.983 0.004 259.938);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.141 0.011 257.05);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.19 0.012 206.266);
  --muted-foreground: oklch(0.737 0.009 206.372);
  --popover: oklch(0.141 0.011 257.05);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.152 0.013 259.344);
  --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.983 0.003 259.938);
  --primary-foreground: oklch(0.462 0.076 259.606);
  --secondary: oklch(0.987 0.003 206.42);
  --secondary-foreground: oklch(0.329 0.035 206.543);
  --accent: oklch(0.981 0.005 291.689);
  --accent-foreground: oklch(0.411 0.11 285.822);
  --destructive: oklch(0.622 0.211 32.969);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.983 0.003 259.938);
  --chart-1: oklch(0.983 0.003 259.938);
  --chart-2: oklch(0.987 0.003 206.42);
  --chart-3: oklch(0.981 0.005 291.689);
  --chart-4: oklch(1.007 0.002 26.452);
  --chart-5: oklch(0.983 0.004 259.938);
}