Displacement for shadcn/ui

Displacement is a shadcn/ui theme built around a neutral gray primary color (#262727) with neutral gray accents (#272626). The light mode uses a neutral background (#fbfefd). Dark mode keeps the neutral gray primary (#262727) on a neutral background (#010403).

Color palette

TokenLightDark
Background
#fbfefdwhite
#010403black
Foreground
#020908black
#f4fafamintcream
Card
#f8fcfcmintcream
#030807black
Card foreground
#010404black
#f8fcfbmintcream
Popover
#fbfefdwhite
#010403black
Popover foreground
#020908black
#f4fafamintcream
Primary
#262727darkslategray
#262727darkslategray
Primary foreground
#bfc0c0silver
#bfc0c0silver
Secondary
#272626darkslategray
#272626darkslategray
Secondary foreground
#c0bfbfsilver
#c0bfbfsilver
Muted
#eeececlinen
#131111black
Muted foreground
#524244darkslategray
#bdadafdarkgray
Accent
#272626darkslategray
#272626darkslategray
Accent foreground
#c0bfbfsilver
#c0bfbfsilver
Destructive
#d5440bchocolate
#f45f25tomato
Destructive foreground
#ffffffwhite
#000000black
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#262727darkslategray
#262727darkslategray

Contrast

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

Light mode
Text on background19.76:1AAA
Text on card19.91:1AAA
Primary button8.24:1AAA
Secondary button8.24:1AAA
Muted text8.03:1AAA
Accent8.24:1AAA
Destructive4.48:1AA Large
Dark mode
Text on background19.51:1AAA
Text on card19.53:1AAA
Primary button8.24:1AAA
Secondary button8.24:1AAA
Muted text8.76:1AAA
Accent8.24:1AAA
Destructive6.51:1AA

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.994 0.002 187.689);
  --foreground: oklch(0.127 0.017 187.133);
  --muted: oklch(0.945 0.003 7.82);
  --muted-foreground: oklch(0.396 0.023 9.141);
  --popover: oklch(0.994 0.002 187.689);
  --popover-foreground: oklch(0.127 0.017 187.133);
  --card: oklch(0.988 0.005 187.629);
  --card-foreground: oklch(0.101 0.013 187.133);
  --border: oklch(0.928 0.006 264.531);
  --input: oklch(0.928 0.006 264.531);
  --primary: oklch(0.27 0.001 187.646);
  --primary-foreground: oklch(0.806 0.001 187.705);
  --secondary: oklch(0.269 0.001 7.853);
  --secondary-foreground: oklch(0.805 0.001 7.793);
  --accent: oklch(0.269 0.001 7.853);
  --accent-foreground: oklch(0.805 0.001 7.793);
  --destructive: oklch(0.589 0.19 37.572);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.27 0.001 187.646);
  --chart-1: oklch(0.27 0.001 187.646);
  --chart-2: oklch(0.269 0.001 7.853);
  --chart-3: oklch(0.269 0.001 7.853);
  --chart-4: oklch(0.3 0.001 7.858);
  --chart-5: oklch(0.273 0.004 187.342);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.098 0.01 187.267);
  --foreground: oklch(0.982 0.007 187.584);
  --muted: oklch(0.179 0.004 8.318);
  --muted-foreground: oklch(0.762 0.019 8.355);
  --popover: oklch(0.098 0.01 187.267);
  --popover-foreground: oklch(0.982 0.007 187.584);
  --card: oklch(0.124 0.013 187.267);
  --card-foreground: oklch(0.988 0.004 187.64);
  --border: oklch(0.278 0.03 256.848);
  --input: oklch(0.278 0.03 256.848);
  --primary: oklch(0.27 0.001 187.646);
  --primary-foreground: oklch(0.806 0.001 187.705);
  --secondary: oklch(0.269 0.001 7.853);
  --secondary-foreground: oklch(0.805 0.001 7.793);
  --accent: oklch(0.269 0.001 7.853);
  --accent-foreground: oklch(0.805 0.001 7.793);
  --destructive: oklch(0.671 0.194 39.531);
  --destructive-foreground: oklch(0 0 0);
  --ring: oklch(0.27 0.001 187.646);
  --chart-1: oklch(0.27 0.001 187.646);
  --chart-2: oklch(0.269 0.001 7.853);
  --chart-3: oklch(0.269 0.001 7.853);
  --chart-4: oklch(0.3 0.001 7.858);
  --chart-5: oklch(0.273 0.004 187.342);
}