Constraint for shadcn/ui

Constraint is a shadcn/ui theme built around a neutral gray primary color (#999d95) with neutral gray accents (#99959d). The light mode uses a neutral background (#fcfdfc). Dark mode keeps the neutral gray primary (#999d95) on a neutral background (#050802).

Color palette

TokenLightDark
Background
#fcfdfcwhite
#050802black
Foreground
#0a1004black
#ffffffwhite
Card
#fcfdfcwhite
#050802black
Card foreground
#0a1004black
#ffffffwhite
Popover
#fcfdfcwhite
#050802black
Popover foreground
#0a1004black
#ffffffwhite
Primary
#999d95darkgray
#999d95darkgray
Primary foreground
#000000black
#000000black
Secondary
#99959ddarkgray
#99959ddarkgray
Secondary foreground
#000000black
#000000black
Muted
#d9d0e2gainsboro
#261d2fdarkslategray
Muted foreground
#61576bdimgray
#9e94a8darkgray
Accent
#99959ddarkgray
#99959ddarkgray
Accent foreground
#000000black
#000000black
Destructive
#ac2311firebrick
#e32e16orangered
Destructive foreground
#fef3f1seashell
#ffffffwhite
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#999d95darkgray
#999d95darkgray

Contrast

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

Light mode
Text on background18.96:1AAA
Text on card18.96:1AAA
Primary button7.61:1AAA
Secondary button7.13:1AAA
Muted text4.54:1AA
Accent7.13:1AAA
Destructive6.44:1AA
Dark mode
Text on background20.15:1AAA
Text on card20.15:1AAA
Primary button7.61:1AAA
Secondary button7.13:1AAA
Muted text5.57:1AA
Accent7.13:1AAA
Destructive4.47:1AA Large

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.994 0.002 128.487);
  --foreground: oklch(0.164 0.029 128.807);
  --muted: oklch(0.869 0.027 308.118);
  --muted-foreground: oklch(0.474 0.033 307.691);
  --popover: oklch(0.994 0.002 128.487);
  --popover-foreground: oklch(0.164 0.029 128.807);
  --card: oklch(0.994 0.002 128.487);
  --card-foreground: oklch(0.164 0.029 128.807);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.69 0.013 128.666);
  --primary-foreground: oklch(0 0 0);
  --secondary: oklch(0.676 0.013 308.252);
  --secondary-foreground: oklch(0 0 0);
  --accent: oklch(0.676 0.013 308.252);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.484 0.175 31.036);
  --destructive-foreground: oklch(0.971 0.012 26.526);
  --ring: oklch(0.69 0.013 128.666);
  --chart-1: oklch(0.69 0.013 128.666);
  --chart-2: oklch(0.676 0.013 308.252);
  --chart-3: oklch(0.676 0.013 308.252);
  --chart-4: oklch(0.701 0.012 308.276);
  --chart-5: oklch(0.696 0.022 128.817);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.127 0.02 127.328);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.251 0.036 306.828);
  --muted-foreground: oklch(0.683 0.03 307.972);
  --popover: oklch(0.127 0.02 127.328);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.127 0.02 127.328);
  --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.69 0.013 128.666);
  --primary-foreground: oklch(0 0 0);
  --secondary: oklch(0.676 0.013 308.252);
  --secondary-foreground: oklch(0 0 0);
  --accent: oklch(0.676 0.013 308.252);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.595 0.218 31.01);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.69 0.013 128.666);
  --chart-1: oklch(0.69 0.013 128.666);
  --chart-2: oklch(0.676 0.013 308.252);
  --chart-3: oklch(0.676 0.013 308.252);
  --chart-4: oklch(0.701 0.012 308.276);
  --chart-5: oklch(0.696 0.022 128.817);
}