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.

TokenLightDarkUse
background#F7F5F0#120D0AScreen background behind grouped content.
foreground#2A1D17#F5F1EAPrimary text and icons on background and surface.
muted#6F5E55#B3A396Secondary text: hints, descriptions, captions.
surface#FFFFFF#1C1511Content containers: cards, grouped lists, fields at rest.
surfaceForeground#2A1D17#F5F1EAText and icons on surface.
surfaceSecondary#F1EDE6#261D18A container nested in a surface.
surfaceTertiary#E9E3DA#30251FA third level, such as a pressed row.
overlay#FFFFFF#221A15Floating layers above content: menus, popovers, toasts, sheets.
overlayForeground#2A1D17#F5F1EAText and icons on overlay.
default#ECE6DD#2E241ENeutral fill for secondary controls such as secondary buttons and chips.
defaultForeground#2A1D17#F5F1EAText and icons on default.
accent#CC4A0F#FF7A33The one brand fill: primary actions, selection, progress.
accentForeground#FFFFFF#1A120EText and icons on accent.
accentSoft#FDEBDD#3A1D0ELow-emphasis accent fill: soft buttons, chips, alerts.
accentSoftForeground#9A3412#FFB283Text and icons on accentSoft.
success#15803D#4ADE80The success intent fill.
successForeground#FFFFFF#052E16Text and icons on success.
successSoft#DCF5E4#0F2A1ALow-emphasis success fill: soft buttons, chips, alerts.
successSoftForeground#14532D#86EFACText and icons on successSoft.
warning#B45309#FBBF24The warning intent fill.
warningForeground#FFFFFF#1F1300Text and icons on warning.
warningSoft#FEF0D6#2E2108Low-emphasis warning fill: soft buttons, chips, alerts.
warningSoftForeground#78350F#FCD34DText and icons on warningSoft.
danger#B91C1C#F87171The danger intent fill.
dangerForeground#FFFFFF#2A0A0AText and icons on danger.
dangerSoft#FDE4E2#3A1414Low-emphasis danger fill: soft buttons, chips, alerts.
dangerSoftForeground#7F1D1D#FCA5A5Text and icons on dangerSoft.
fieldBackground#FFFFFF#1C1511Editor fill.
fieldForeground#2A1D17#F5F1EATyped text.
fieldPlaceholder#8C7B70#8F7F73Placeholder text.
fieldBorder#DDD4C8#3A2D25Editor outline at rest.
border#E4D9CC#3A2D25Outlines of containers and quiet controls.
separator#E9E1D6#2E241EHairlines between rows and sections.
focus#CC4A0F#FF7A33Focus ring and the outline of an active field.
link#B8420B#FF9A5CLink text.
backdrop#1A120E66#000000A0Dimming 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>;
}
VariantSize / lineWeightSample
largeTitle34 / 41boldNative views
title128 / 34boldNative views
title222 / 28boldNative views
title320 / 25semiboldNative views
headline17 / 22semiboldNative views
body17 / 22regularNative views
callout16 / 21regularNative views
subheadline15 / 20regularNative views
footnote13 / 18regularNative views
caption112 / 16regularNative views
caption211 / 13regularNative views

Spacing

TokenValueScale
spacing.none0 pt
spacing.xxs2 pt
spacing.xs4 pt
spacing.sm8 pt
spacing.md12 pt
spacing.lg16 pt
spacing.xl20 pt
spacing.xxl24 pt
spacing.xxxl32 pt
spacing.gutter20 pt

Radius

field, control, card, sheet and pill are semantic radii; use them in components so a theme can round fields without rounding cards.

TokenValueShape
radius.none0 pt
radius.xs4 pt
radius.sm8 pt
radius.md12 pt
radius.lg16 pt
radius.xl22 pt
radius.xxl28 pt
radius.fullFully rounded
radius.field14 pt
radius.control14 pt
radius.card22 pt
radius.sheet28 pt
radius.pillFully 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.

TokenValue
motion.duration.instant0 s
motion.duration.fast0.15 s
motion.duration.normal0.25 s
motion.duration.slow0.4 s
motion.spring.snappy0.3 s, damping ratio 0.86
motion.spring.smooth0.45 s, damping ratio 1
motion.spring.bouncy0.5 s, damping ratio 0.68
motion.pressedScale0.97
motion.pressedOpacity0.7

Controls and opacity

Interactive heights per size. Every touch target keeps at least a 44-point hit area, even at sm.

TokenValue
control.sm36 pt high
control.md44 pt high
control.lg52 pt high
opacity.disabled0.45
opacity.pressed0.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

  • reducedMotion makes motionDuration return zero, so pressed, open and close transitions jump to their end state, and indeterminate spinners stop where the family supports it.
  • reducedTransparency turns every MaterialView into its opaque fallback. isReduceTransparencyEnabled() from nitro-ui-sdk/semantics reads 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.