Theming
The Ember tokens for color, spacing, radius, type and motion, how to override them with createTokens, and how dark mode, reduced motion and reduced transparency reach every family.
On this page
Every family reads its look from ThemeProvider in nitro-ui-sdk/theme. The provider holds two token sets, light and dark, and the person’s motion and transparency preferences. Components resolve their styles from these tokens only, so a new palette or a scheme change restyles the whole kit. The tables on this page are generated from packages/nitro-ui-sdk/src/theme/tokens.ts.
ThemeProvider
import { ThemeProvider, defaultTokens } from "nitro-ui-sdk/theme";
<ThemeProvider
scheme={scheme} // "light" | "dark", required
tokens={defaultTokens} // Record<"light" | "dark", ThemeTokens>
glass // request Liquid Glass (default true)
reducedMotion={false} // durations collapse to zero
reducedTransparency={false} // opaque surfaces instead of glass
>
<App />
</ThemeProvider>;
Inside the tree, useTheme() returns the resolved theme and useTokens() the current token set:
type Theme = {
scheme: "light" | "dark";
tokens: ThemeTokens;
reducedMotion: boolean;
reducedTransparency: boolean;
glass: boolean; // the app asks for glass
material: "glass" | "opaque"; // glass is drawn: requested, iOS 26+, transparency not reduced
};
Colors
Color names follow intent. A bare name is a fill (accent) and its Foreground pair is the text and icon color drawn on that fill. Each intent (accent, success, warning, danger) also has a Soft fill and a SoftForeground for low-emphasis use.
| Token | Light | Dark | Use |
|---|---|---|---|
background | #F7F5F0 | #120D0A | Screen background behind grouped content. |
foreground | #2A1D17 | #F5F1EA | Primary text and icons on background and surface. |
muted | #6F5E55 | #B3A396 | Secondary text: hints, descriptions, captions. |
surface | #FFFFFF | #1C1511 | Content containers: cards, grouped lists, fields at rest. |
surfaceForeground | #2A1D17 | #F5F1EA | Text and icons on surface. |
surfaceSecondary | #F1EDE6 | #261D18 | A container nested in a surface. |
surfaceTertiary | #E9E3DA | #30251F | A third level, such as a pressed row. |
overlay | #FFFFFF | #221A15 | Floating layers above content: menus, popovers, toasts, sheets. |
overlayForeground | #2A1D17 | #F5F1EA | Text and icons on overlay. |
default | #ECE6DD | #2E241E | Neutral fill for secondary controls such as secondary buttons and chips. |
defaultForeground | #2A1D17 | #F5F1EA | Text and icons on default. |
accent | #CC4A0F | #FF7A33 | The one brand fill: primary actions, selection, progress. |
accentForeground | #FFFFFF | #1A120E | Text and icons on accent. |
accentSoft | #FDEBDD | #3A1D0E | Low-emphasis accent fill: soft buttons, chips, alerts. |
accentSoftForeground | #9A3412 | #FFB283 | Text and icons on accentSoft. |
success | #15803D | #4ADE80 | The success intent fill. |
successForeground | #FFFFFF | #052E16 | Text and icons on success. |
successSoft | #DCF5E4 | #0F2A1A | Low-emphasis success fill: soft buttons, chips, alerts. |
successSoftForeground | #14532D | #86EFAC | Text and icons on successSoft. |
warning | #B45309 | #FBBF24 | The warning intent fill. |
warningForeground | #FFFFFF | #1F1300 | Text and icons on warning. |
warningSoft | #FEF0D6 | #2E2108 | Low-emphasis warning fill: soft buttons, chips, alerts. |
warningSoftForeground | #78350F | #FCD34D | Text and icons on warningSoft. |
danger | #B91C1C | #F87171 | The danger intent fill. |
dangerForeground | #FFFFFF | #2A0A0A | Text and icons on danger. |
dangerSoft | #FDE4E2 | #3A1414 | Low-emphasis danger fill: soft buttons, chips, alerts. |
dangerSoftForeground | #7F1D1D | #FCA5A5 | Text and icons on dangerSoft. |
fieldBackground | #FFFFFF | #1C1511 | Editor fill. |
fieldForeground | #2A1D17 | #F5F1EA | Typed text. |
fieldPlaceholder | #8C7B70 | #8F7F73 | Placeholder text. |
fieldBorder | #DDD4C8 | #3A2D25 | Editor outline at rest. |
border | #E4D9CC | #3A2D25 | Outlines of containers and quiet controls. |
separator | #E9E1D6 | #2E241E | Hairlines between rows and sections. |
focus | #CC4A0F | #FF7A33 | Focus ring and the outline of an active field. |
link | #B8420B | #FF9A5C | Link text. |
backdrop | #1A120E66 | #000000A0 | Dimming layer behind modal content. |
Families written before the semantic palette used text, textSecondary, primary, onPrimary, surfaceElevated, dangerText, dangerFill and onDanger. These names still resolve to the semantic values above and are being removed; new code uses the semantic names.
Type scale
The text variants are Apple’s text styles at the default content size, so the kit’s type matches the rest of iOS. Spread them onto NitroUI Text with textStyle(tokens, variant, color?):
import { Text } from "nitro-ui-renderer";
import { textStyle, useTokens } from "nitro-ui-sdk/theme";
function Caption({ children }: { children: string }) {
const tokens = useTokens();
return <Text {...textStyle(tokens, "footnote", tokens.colors.muted)}>{children}</Text>;
}
| Variant | Size / line | Weight | Sample |
|---|---|---|---|
largeTitle | 34 / 41 | bold | Native views |
title1 | 28 / 34 | bold | Native views |
title2 | 22 / 28 | bold | Native views |
title3 | 20 / 25 | semibold | Native views |
headline | 17 / 22 | semibold | Native views |
body | 17 / 22 | regular | Native views |
callout | 16 / 21 | regular | Native views |
subheadline | 15 / 20 | regular | Native views |
footnote | 13 / 18 | regular | Native views |
caption1 | 12 / 16 | regular | Native views |
caption2 | 11 / 13 | regular | Native views |
Spacing
| Token | Value | Scale |
|---|---|---|
spacing.none | 0 pt | |
spacing.xxs | 2 pt | |
spacing.xs | 4 pt | |
spacing.sm | 8 pt | |
spacing.md | 12 pt | |
spacing.lg | 16 pt | |
spacing.xl | 20 pt | |
spacing.xxl | 24 pt | |
spacing.xxxl | 32 pt | |
spacing.gutter | 20 pt |
Radius
field, control, card, sheet and pill are semantic radii; use them in components so a theme can round fields without rounding cards.
| Token | Value | Shape |
|---|---|---|
radius.none | 0 pt | |
radius.xs | 4 pt | |
radius.sm | 8 pt | |
radius.md | 12 pt | |
radius.lg | 16 pt | |
radius.xl | 22 pt | |
radius.xxl | 28 pt | |
radius.full | Fully rounded | |
radius.field | 14 pt | |
radius.control | 14 pt | |
radius.card | 22 pt | |
radius.sheet | 28 pt | |
radius.pill | Fully rounded |
Motion
Durations are in seconds, matching NitroUI’s View.animate. Read them through motionDuration(theme, speed), which returns zero when the theme asks for reduced motion.
| Token | Value |
|---|---|
motion.duration.instant | 0 s |
motion.duration.fast | 0.15 s |
motion.duration.normal | 0.25 s |
motion.duration.slow | 0.4 s |
motion.spring.snappy | 0.3 s, damping ratio 0.86 |
motion.spring.smooth | 0.45 s, damping ratio 1 |
motion.spring.bouncy | 0.5 s, damping ratio 0.68 |
motion.pressedScale | 0.97 |
motion.pressedOpacity | 0.7 |
Controls and opacity
Interactive heights per size. Every touch target keeps at least a 44-point hit area, even at sm.
| Token | Value |
|---|---|
control.sm | 36 pt high |
control.md | 44 pt high |
control.lg | 52 pt high |
opacity.disabled | 0.45 |
opacity.pressed | 0.7 |
Your own palette with createTokens
createTokens builds both schemes from partial overrides and keeps every other token. Create it once, outside render, so the provider’s value stays stable.
import { ThemeProvider, createTokens } from "nitro-ui-sdk/theme";
const brand = createTokens({
light: { accent: "#1D4ED8", accentForeground: "#FFFFFF", focus: "#1D4ED8", link: "#1D4ED8" },
dark: { accent: "#60A5FA", accentForeground: "#0B1220", focus: "#60A5FA", link: "#93C5FD" },
radius: { control: 10, field: 10 },
});
export function App({ scheme }: { scheme: "light" | "dark" }) {
return (
<ThemeProvider scheme={scheme} tokens={brand}>
<Home />
</ThemeProvider>
);
}
Override pairs together: a new accent needs an accentForeground with enough contrast on it, and usually focus and link.
Dark mode
The kit does not watch the system appearance by itself; pass the scheme you want. The example app reads Appearance.getColorScheme() once, keeps the person’s choice in its own settings and calls Appearance.setColorScheme(scheme) so native controls, pickers and system sheets follow the app’s appearance:
import { Appearance } from "nitro-ui-renderer";
Appearance.setColorScheme(scheme); // native widgets draw in the same scheme as the tokens
Reduced motion and reduced transparency
reducedMotionmakesmotionDurationreturn zero, so pressed, open and close transitions jump to their end state, and indeterminate spinners stop where the family supports it.reducedTransparencyturns everyMaterialViewinto its opaque fallback.isReduceTransparencyEnabled()fromnitro-ui-sdk/semanticsreads the system setting, so you can pass it straight through.
import { isReduceTransparencyEnabled } from "nitro-ui-sdk/semantics";
<ThemeProvider scheme={scheme} reducedTransparency={isReduceTransparencyEnabled()}>
<App />
</ThemeProvider>;
See Liquid Glass for the full fallback rules.