Foundations
Theme builder
Pick one brand colour. Nexub turns it into the full accent family for light and dark at standard, medium and high contrast, checks every text pair against WCAG, and gives you the theme as CSS, React, React Native or design tokens. Like Material's theme builder, the seed is a starting hue, not a fixed swatch: a light yellow becomes a readable olive.
Build a theme
Light
Dark
Contrast check
WCAG 2.2 ratios for every contrast level and scheme. Text pairs need 4.5:1. The accent on the surface needs 4.5:1 too, because it is used for text and links; it is measured against the surface in the preview above, so it shows for the selected level.
| Contrast | Scheme | on-primary on primary | on-primary-container on primary-container | primary on surface |
|---|---|---|---|---|
| standard | light | 6.48 ✓ | 13.31 ✓ | — |
| standard | dark | 7.74 ✓ | 7.25 ✓ | — |
| medium | light | 7.77 ✓ | 14.72 ✓ | — |
| medium | dark | 10.27 ✓ | 8.24 ✓ | — |
| high | light | 9.34 ✓ | 16.31 ✓ | — |
| high | dark | 13.31 ✓ | 9.34 ✓ | — |
Export
:root {
--color-primary: light-dark(#ae3108, #ffb5a0);
--color-on-primary: light-dark(#ffffff, #601400);
--color-primary-container: light-dark(#ffdbd1, #872100);
--color-on-primary-container: light-dark(#3b0900, #ffdbd1);
--color-inverse-primary: light-dark(#ffb5a0, #ae3108);
}
:root[data-contrast='medium'], [data-contrast='medium'] :root {
--color-primary: light-dark(#9c2700, #ffc8b9);
--color-on-primary: light-dark(#ffffff, #4d0f00);
--color-primary-container: light-dark(#ffdbd1, #872100);
--color-on-primary-container: light-dark(#280400, #ffede8);
--color-inverse-primary: light-dark(#ffb5a0, #ae3108);
}
:root[data-contrast='high'], [data-contrast='high'] :root {
--color-primary: light-dark(#872100, #ffdbd1);
--color-on-primary: light-dark(#ffffff, #3b0900);
--color-primary-container: light-dark(#ffdbd1, #872100);
--color-on-primary-container: light-dark(#000000, #ffffff);
--color-inverse-primary: light-dark(#ffb5a0, #ae3108);
}
@media (prefers-contrast: more) {
:root:root:not([data-contrast]), :root:not([data-contrast]) :root {
--color-primary: light-dark(#872100, #ffdbd1);
--color-on-primary: light-dark(#ffffff, #3b0900);
--color-primary-container: light-dark(#ffdbd1, #872100);
--color-on-primary-container: light-dark(#000000, #ffffff);
--color-inverse-primary: light-dark(#ffb5a0, #ae3108);
}
}
How it works
The seed becomes an HCT tonal palette, and each role takes a fixed tone, so contrast is arithmetic: the same tone gaps that make the built-in brands pass make yours pass.
Primary recolours the app accent (buttons, focus, links). Product brand recolours the tertiary family that
data-productbrands use.Neutrals, surfaces, status colours and the chart palettes stay on Nexub, so error, success and data stay recognisable across brands.
The CSS export carries all three contrast levels and
prefers-contrast: more, so the contrast switch works with your brand like it does with ours.
The same functions are in code: createSeedStylesheet, createSeedTheme, createSeedRoles, createSeedTokens and contrastRatio from @nexub/tokens/seed. See Colors for the role system.