Colors API
ARCUI 2.0.0 semantic tones, TThemeColor, component-specific colors, token fallback, and native style ownership.
ARCUI 2.0.0 gives visual components strongly typed, component-specific colors objects. Semantic tone presets cover controls where color communicates meaning. Every instance override is optional: you can change one slot without replacing the other states or theme tokens.
The shared TThemeColor primitive
import type { TThemeColor } from "react-native-arc-ui";
const fixed: TThemeColor = "rgba(0,122,255,1)";
const themeAware: TThemeColor = {
light: "rgba(0,64,135,1)",
dark: "rgba(151,204,255,1)",
};- A string is fixed across light and dark themes.
- A complete
{ light, dark }pair uses ARCUI's animated theme progress. - Both keys are required; the public contract deliberately does not accept an incomplete pair.
- ARCUI's own examples use explicit
rgba(...)strings. The consumer API still accepts other valid React Native color strings.
Color resolution
1. An explicitly provided colors slot for this instance
2. The matching semantic tone and visual/interaction state, when available
3. The component's light/dark design tokensAn omitted colors slot leaves the component's existing semantic state intact. For example, overriding a Button's default background does not replace its pressed, disabled, or text colors.
For native style escape hatches that own the same property (such as Text.style.color and ThemedView.style.backgroundColor), a provided colors slot wins. When that slot is absent, the native style retains ownership before ARCUI falls back to tokens.
Semantic tones
| Component | Available tone values | Default |
|---|---|---|
| Button | primary, secondary, neutral, danger | primary |
| Badge | neutral, info, success, warning, danger | danger |
| Toast | neutral, info, success, warning, danger | neutral |
| Infobox | info, success, warning, danger | info |
| Dropdown item | neutral, danger | neutral |
| Dialog action | Button tones | primary |
| Tab dot badge | Badge tones | Badge default |
tone describes semantics; it does not replace a component's presentation type (Button still supports solid, border, and transparent). Components without a public tone prop continue to resolve colors from their own state/presentation tokens.
<Button tone="danger" type="solid">Remove</Button>
<Badge tone="success" label="Synced" />
<Infobox tone="warning">Changes have not been saved.</Infobox>Customize just one slot
import { Button, Text, ThemedView } from "react-native-arc-ui";
<Button
tone="secondary"
colors={{
background: {
default: { light: "rgba(232,242,255,1)", dark: "rgba(18,42,66,1)" },
pressed: "rgba(196,220,247,1)",
},
text: { default: "rgba(0,64,135,1)" },
}}
>
Preview
</Button>
<ThemedView colors={{ background: "rgba(20,20,20,1)" }}>
<Text colors={{ text: "rgba(255,255,255,1)" }}>Fixed colors</Text>
</ThemedView>Fixed color overrides will not automatically adapt their contrast when the theme changes. When setting backgrounds and text explicitly, ensure adequate contrast in both modes and in disabled/pressed states.
Shared field colors
Input, InputPassword, InputArea, InputNumber, and InputOTP reuse the shared field color contract, with each field exposing the subset relevant to its presentation.
import { Input } from "react-native-arc-ui";
<Input
value={email}
onChangeText={setEmail}
label="Email"
colors={{
border: {
focused: "rgba(0,122,255,1)",
error: "rgba(211,47,47,1)",
},
placeholder: {
light: "rgba(90,90,90,1)",
dark: "rgba(170,170,170,1)",
},
}}
/>Field slots include background, border, text, placeholder, label, icon, clearButton, and error. The exact nested states differ by slot; see each component's generated API reference and the public IFieldColors type.
Where to find component slots
| Component group | Representative colors slots |
|---|---|
| Button | background.*, border.*, text.*, loading |
| Badge | background, text (label badges only) |
| Text / ThemedView / Screen | text, background, background respectively |
| Icon / SpinnerLoader | icon, indicator respectively |
| Divider | line, label |
| Checkbox / Radio / Toggle / Chip | Component-specific selection, pressed, disabled, and validation slots |
| Accordion / Select / Dropdown | Component-specific presentation, items, and active/disabled states |
| Header / Tabs | Surface, text/icon/control, indicator, and active/inactive slots |
| Modal / Dialog / Toast / Infobox | Backdrop/surface/content/feedback slots as exposed by each public type |
| ProgressBar / Slider / SkeletonLoader | Track/fill/value, tooltip/thumb, base/highlight slots |
The table is a discovery map, not a replacement for the exact TypeScript interfaces. These are exported from the package root (for example, IButtonColors, IFieldColors, and ISelectColors). Do not guess nested slot names; use the API table on the relevant component page or the installed package declarations.
Token ownership
For consistent application-wide changes, configure the complete top-level colors token namespace rather than placing the same colors props on many instances. ARCUI token overrides are shallow at the top level:
import { ARCUI, defaultTokens, type TTokensOverride } from "react-native-arc-ui";
const tokens = {
colors: {
...defaultTokens.colors,
// Replace complete light/dark component token subtrees as required.
},
} satisfies TTokensOverride;
<ARCUI tokens={tokens}>{children}</ARCUI>;The old top-level colors.states namespace no longer exists. Semantic defaults now live in component-owned tokens such as colors.light.checkbox.error and colors.dark.checkbox.error.
Migrating from 1.x
The previous color, darkColor, lightColor, Badge text-color, and Tabs background-color prop families were replaced by typed colors slots. Dropdown items use tone="danger" instead of destructive; Infobox uses tone instead of type.