Nanoparticle for shadcn/ui

Nanoparticle is a shadcn/ui theme built around a muted violet primary color (#634974) with muted light violet accents (#d2cdd5). The light mode uses a neutral background (#faf8fc). Dark mode keeps the muted violet primary (#634974) on a neutral background (#030203).

Color palette

TokenLightDark
Background
#faf8fcghostwhite
#030203black
Foreground
#000000black
#ffffffwhite
Card
#f8f5fawhitesmoke
#050307black
Card foreground
#000000black
#ffffffwhite
Popover
#f8f5fawhitesmoke
#050307black
Popover foreground
#000000black
#ffffffwhite
Primary
#634974dimgray
#634974dimgray
Primary foreground
#f8f6f9whitesmoke
#f8f6f9whitesmoke
Secondary
#ebeaeblavender
#221e24black
Secondary foreground
#525152darkslategray
#bcb4c0silver
Muted
#e9e4eclavender
#18131bblack
Muted foreground
#534b58darkslategray
#afa7b4darkgray
Accent
#d2cdd5lightgrey
#3a2f42darkslategray
Accent foreground
#39343ddarkslategray
#d3c9d9thistle
Destructive
#c84609chocolate
#f6773ccoral
Destructive foreground
#ffffffwhite
#000000black
Border
#e5e7eblavender
#1f2937darkslategray
Input
#e5e7eblavender
#1f2937darkslategray
Ring
#634974dimgray
#634974dimgray

Contrast

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

Light mode
Text on background19.92:1AAA
Text on card19.40:1AAA
Primary button7.15:1AAA
Secondary button6.59:1AA
Muted text6.66:1AA
Accent7.77:1AAA
Destructive4.86:1AA
Dark mode
Text on background20.73:1AAA
Text on card20.48:1AAA
Primary button7.15:1AAA
Secondary button8.14:1AAA
Muted text7.85:1AAA
Accent7.91:1AAA
Destructive7.61:1AAA

CSS variables

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

:root {
  --radius: 0.5rem;
  --background: oklch(0.982 0.005 312.951);
  --foreground: oklch(0 0 0);
  --muted: oklch(0.925 0.012 312.895);
  --muted-foreground: oklch(0.426 0.024 312.61);
  --popover: oklch(0.973 0.007 312.933);
  --popover-foreground: oklch(0 0 0);
  --card: oklch(0.973 0.007 312.933);
  --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.45 0.076 311.802);
  --primary-foreground: oklch(0.975 0.005 312.949);
  --secondary: oklch(0.939 0.001 312.981);
  --secondary-foreground: oklch(0.436 0.003 312.939);
  --accent: oklch(0.855 0.011 312.896);
  --accent-foreground: oklch(0.333 0.017 312.634);
  --destructive: oklch(0.568 0.176 39.548);
  --destructive-foreground: oklch(1 0 180);
  --ring: oklch(0.45 0.076 311.802);
  --chart-1: oklch(0.45 0.076 311.802);
  --chart-2: oklch(0.939 0.001 312.981);
  --chart-3: oklch(0.855 0.011 312.896);
  --chart-4: oklch(0.962 0 312.983);
  --chart-5: oklch(0.447 0.085 311.622);
}

.dark {
  --radius: 0.5rem;
  --background: oklch(0.087 0.01 313.988);
  --foreground: oklch(1 0 180);
  --muted: oklch(0.196 0.018 312.36);
  --muted-foreground: oklch(0.739 0.021 312.796);
  --popover: oklch(0.109 0.013 313.988);
  --popover-foreground: oklch(1 0 180);
  --card: oklch(0.109 0.013 313.988);
  --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.45 0.076 311.802);
  --primary-foreground: oklch(0.975 0.005 312.949);
  --secondary: oklch(0.242 0.012 312.639);
  --secondary-foreground: oklch(0.78 0.019 312.817);
  --accent: oklch(0.324 0.037 312.214);
  --accent-foreground: oklch(0.849 0.024 312.795);
  --destructive: oklch(0.708 0.171 43.471);
  --destructive-foreground: oklch(0 0 0);
  --ring: oklch(0.45 0.076 311.802);
  --chart-1: oklch(0.45 0.076 311.802);
  --chart-2: oklch(0.242 0.012 312.639);
  --chart-3: oklch(0.324 0.037 312.214);
  --chart-4: oklch(0.273 0.015 312.618);
  --chart-5: oklch(0.447 0.085 311.622);
}