Color
The NachUI palette in light and dark mode, the foreground convention and the measured contrast of every text pair.
Color in NachUI is mostly neutral. Light mode is built from warm paper grays with a faint tint (hue 75 to 85, very low chroma), so white never reads clinical. Dark mode uses pure grays with zero chroma, stepped so surfaces stack clearly on a near-black canvas. The only real hues are the four feedback colors and the syntax highlighting, which reuses them.
Every value below is read straight from the
nachui theme files, light.tokens.json and dark.tokens.json, so this page cannot drift from what the components ship.Palette
Tokens are grouped the same way as in the token files. Each row shows the CSS variable, the Tailwind utility you would usually reach for (every color token also gets the
bg-, text-, border- and ring- forms), and the value in both modes.SurfaceLightDark
- --backgroundbg-backgroundoklch(100% 0 0)#ffffffoklch(13% 0 0)#070707
- --foregroundtext-foregroundoklch(19% 0 0)#141414oklch(97% 0 0)#f5f5f5
- --cardbg-cardoklch(100% 0 0)#ffffffoklch(22.5% 0 0)#1c1c1c
- --card-foregroundtext-card-foregroundoklch(19% 0 0)#141414oklch(97% 0 0)#f5f5f5
- --popoverbg-popoveroklch(100% 0 0)#ffffffoklch(25% 0 0)#222222
- --popover-foregroundtext-popover-foregroundoklch(19% 0 0)#141414oklch(97% 0 0)#f5f5f5
- --surface-mutedbg-surface-mutedoklch(96.2% 0 0)#f2f2f2oklch(18.5% 0 0)#131313
- --inversebg-inverseoklch(19% 0 0)#141414oklch(97% 0 0)#f5f5f5
- --inverse-foregroundtext-inverse-foregroundoklch(98.5% 0 0)#fafafaoklch(18% 0 0)#121212
- --overlaybg-overlayoklch(19% 0 0 / 0.5)#141414 @ 0.5oklch(0% 0 0 / 0.72)#000000 @ 0.72
InteractiveLightDark
- --primarybg-primaryoklch(52% 0.115 234)#0072a0oklch(82% 0.095 230)#80d0f6
- --primary-foregroundtext-primary-foregroundoklch(99% 0.003 230)#fafcfdoklch(22% 0.04 232)#031e2a
- --secondarybg-secondaryoklch(92.5% 0 0)#e6e6e6oklch(30.5% 0 0)#2f2f2f
- --secondary-foregroundtext-secondary-foregroundoklch(19% 0 0)#141414oklch(97% 0 0)#f5f5f5
- --accentbg-accentoklch(94% 0 0)#ebebeboklch(30.5% 0 0)#2f2f2f
- --accent-foregroundtext-accent-foregroundoklch(19% 0 0)#141414oklch(97% 0 0)#f5f5f5
- --mutedbg-mutedoklch(91.5% 0 0)#e3e3e3oklch(30.5% 0 0)#2f2f2f
- --muted-foregroundtext-muted-foregroundoklch(46% 0 0)#585858oklch(76% 0 0)#b1b1b1
- --muted-strongtext-muted-strongoklch(36% 0 0)#3d3d3doklch(87% 0 0)#d4d4d4
StructureLightDark
- --borderborder-borderoklch(88.5% 0 0)#d9d9d9oklch(33.5% 0 0)#373737
- --border-interactiveborder-border-interactiveoklch(60% 0 0)#808080oklch(55% 0 0)#717171
- --inputborder-inputoklch(82% 0 0)#c4c4c4oklch(37% 0 0)#404040
- --ringring-ringoklch(60% 0.115 232)#1c8bb9oklch(82% 0.095 230)#80d0f6
- --ruleborder-ruleoklch(88.5% 0 0)#d9d9d9oklch(33.5% 0 0)#373737
- --grid-colorCSS variable onlyoklch(19% 0 0 / 0.035)#141414 @ 0.035oklch(97% 0 0 / 0.015)#f5f5f5 @ 0.015
FeedbackLightDark
- --destructivebg-destructiveoklch(53% 0.16 27.3)#b63b34oklch(76% 0.15 22.2)#ff8785
- --destructive-foregroundtext-destructive-foregroundoklch(98.5% 0.002 85)#fbfaf9oklch(14.5% 0 0)#0a0a0a
- --destructive-texttext-destructive-textoklch(48% 0.15 27.3)#a1302aoklch(80% 0.13 22.2)#ff9b97
- --destructive-surfacebg-destructive-surfaceoklch(96.5% 0.016 27.3)#fef0eeoklch(24% 0.03 20)#2c1919
- --destructive-borderborder-destructive-borderoklch(87% 0.068 27.3)#fec4bcoklch(34% 0.055 20)#512c2c
- --warningbg-warningoklch(53% 0.108 90.4)#846801oklch(83% 0.111 78.2)#efbe71
- --warning-foregroundtext-warning-foregroundoklch(98.5% 0.002 85)#fbfaf9oklch(14.5% 0 0)#0a0a0a
- --warning-texttext-warning-textoklch(48% 0.098 90.4)#735a00oklch(85% 0.111 78.2)#f6c577
- --warning-surfacebg-warning-surfaceoklch(96.5% 0.028 90.4)#fbf3dfoklch(25% 0.03 80)#292010
- --warning-borderborder-warning-borderoklch(87% 0.07 90.4)#e6d3a0oklch(36% 0.05 84)#4a3b1d
- --successbg-successoklch(53% 0.156 135.6)#3e7e01oklch(80% 0.118 148.9)#86d393
- --success-foregroundtext-success-foregroundoklch(98.5% 0.002 85)#fbfaf9oklch(14.5% 0 0)#0a0a0a
- --success-texttext-success-textoklch(48% 0.14 135.6)#356e03oklch(83% 0.118 148.9)#8fdd9d
- --success-surfacebg-success-surfaceoklch(96.5% 0.028 135.6)#ebf8e6oklch(25% 0.035 153)#14271a
- --success-borderborder-success-borderoklch(87% 0.07 135.6)#c0dfb1oklch(36% 0.06 151)#23462d
- --infobg-infooklch(52% 0.115 234)#0072a0oklch(82% 0.095 230)#80d0f6
- --info-foregroundtext-info-foregroundoklch(98.5% 0.002 85)#fbfaf9oklch(14.5% 0 0)#0a0a0a
- --info-texttext-info-textoklch(45% 0.11 236)#005d89oklch(84% 0.09 228)#89d7f9
- --info-surfacebg-info-surfaceoklch(95.5% 0.028 228)#def4ffoklch(27% 0.04 232)#0f2a37
- --info-borderborder-info-borderoklch(87% 0.06 228)#abddf4oklch(40% 0.06 232)#214d62
CodeLightDark
- --codebg-codeoklch(94.5% 0 0)#edededoklch(16% 0 0)#0d0d0d
- --code-plainCSS variable onlyoklch(19% 0 0)#141414oklch(92.2% 0 0)#e5e5e5
- --code-commentCSS variable onlyoklch(50% 0 0)#636363oklch(66% 0 0)#929292
- --code-punctuationCSS variable onlyoklch(44% 0 0)#525252oklch(76% 0 0)#b1b1b1
- --code-keywordCSS variable onlyoklch(48% 0.15 300)#6c44a4oklch(81.3% 0.069 301.1)#c9b8e8
- --code-stringCSS variable onlyoklch(48% 0.14 135.6)#356e03oklch(83.1% 0.07 150)#a8d5b0
- --code-functionCSS variable onlyoklch(48% 0.15 260.8)#2759b1oklch(82.1% 0.042 257.5)#b4c6e0
- --code-numberCSS variable onlyoklch(48% 0.098 90.4)#735a00oklch(86.1% 0.066 85.8)#e5cfa0
- --code-tagCSS variable onlyoklch(48% 0.15 27.3)#a1302aoklch(79.4% 0.075 18.9)#e8a9a9
A few tokens have no Tailwind utility on purpose.
--grid-color only feeds decorative grid overlays, and the --code-* syntax colors are read by the code block, not written in markup.How the groups work
Surface is the stacking order of the interface. In dark mode surfaces get lighter as they rise: background 14.5%, surface muted 18.2%, card 21.8%, popover 23.9%. That is why anything floating uses
bg-popover and never bg-background: on a dark page a bg-background menu has no edge.Interactive covers fills for controls.
primary is the near-black (or near-white) of main buttons and checked controls, secondary and accent are the quiet fills for secondary buttons and hover states, and muted is the highlight behind menu items, tracks and skeletons. muted-foreground is for captions and placeholders, and muted-strong is the softer body color for long reading text.Structure holds the lines.
border is the default stroke, border-interactive is the stronger stroke fields take on hover and focus, input is the stroke of form fields and ring is the focus ring.Feedback has four hues, each with five tokens. More on that below.
Code colors the code block surface and its syntax tokens, reusing the feedback hues so highlighting stays in the same family.
The foreground convention
Every surface or fill has a matching
-foreground token for the content that sits on it. The surface keeps the bare name and its content gets the suffix.If you use a fill, use its foreground with it. Keeping each pair legible is the theme's job, so a component that follows the pairing inherits that guarantee in every theme.
Feedback: solid, text and surface
Each feedback hue (
destructive, warning, success, info) comes as five tokens:| Token | Use |
|---|---|
--<hue> | Solid fill for buttons and badges that need to stand out |
--<hue>-foreground | Text and icons on that solid fill |
--<hue>-text | The hue tuned for text on a normal surface or its own tint |
--<hue>-surface | Tinted background for callouts, banners and toasts |
--<hue>-border | Stroke that goes with the tinted surface |
So why is there a
-text token when the solid already exists? The solid is tuned to carry a light label on top of it, not to be read as text itself. In light mode every solid sits at the same 53% lightness, which keeps one state from shouting louder than another but leaves little room as text: success on success-surface only reaches 4.55:1. The -text tokens sit 5 points darker, which gives small text a real margin above AA (5.66:1 for the same pair). In dark mode the two match, because a light hue on a dark surface already has plenty of contrast.The rule is short: text and icons on a page or a tinted surface use
text-<hue>-text, filled controls use bg-<hue> text-<hue>-foreground.Info is deliberately neutral in dark mode, since a saturated blue on near black reads louder than anything else on the page.
Contrast
Each pair below is measured when the page is built, from the same token files, using the WCAG 2.1 contrast formula after converting OKLCH to sRGB. Text pairs need 4.5:1 for AA and 7:1 for AAA. Strokes and focus rings are non-text UI, so their bar is 3:1.
| Pair | Light | Dark |
|---|---|---|
| foregroundon background | 18.46:1AAA | 18.44:1AAA |
| card-foregroundon card | 18.46:1AAA | 15.68:1AAA |
| popover-foregroundon popover | 18.46:1AAA | 14.66:1AAA |
| inverse-foregroundon inverse | 17.68:1AAA | 17.24:1AAA |
| primary-foregroundon primary | 5.19:1AA | 10.06:1AAA |
| secondary-foregroundon secondary | 14.79:1AAA | 12.28:1AAA |
| accent-foregroundon accent | 15.48:1AAA | 12.28:1AAA |
| muted-strongon background | 10.86:1AAA | 13.57:1AAA |
| muted-foregroundon background | 7.12:1AAA | 9.36:1AAA |
| muted-foregroundon card | 7.12:1AAA | 7.96:1AAA |
| muted-foregroundon muted | 5.53:1AA | 6.23:1AA |
| destructive-foregroundon destructive | 5.47:1AA | 8.53:1AAA |
| destructive-texton destructive-surface | 6.34:1AA | 8.19:1AAA |
| destructive-texton background | 7.05:1AAA | 9.92:1AAA |
| warning-foregroundon warning | 5.07:1AA | 11.60:1AAA |
| warning-texton warning-surface | 5.93:1AA | 10.03:1AAA |
| warning-texton background | 6.56:1AA | 12.59:1AAA |
| success-foregroundon success | 4.78:1AA | 11.07:1AAA |
| success-texton success-surface | 5.66:1AA | 9.77:1AAA |
| success-texton background | 6.21:1AA | 12.43:1AAA |
| info-foregroundon info | 5.12:1AA | 11.56:1AAA |
| info-texton info-surface | 6.34:1AA | 9.34:1AAA |
| info-texton background | 7.19:1AAA | 12.56:1AAA |
| border-interactiveon background (non-text) | 3.94:13:1 | 4.14:13:1 |
| ringon background (non-text) | 3.85:13:1 | 11.75:13:1 |
muted-foreground on muted is the tightest text pair, and it still clears AA in both modes. If you change a token in your own theme, run the same check before shipping.Customizing
These are the values of the default
nachui theme. To bring your own brand, redefine the variables on :root and .dark; components only read tokens, so nothing else changes. Theming walks through it.Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.