Theme picker, accent swatches, and text-size slider.
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, List, Slider, Switch, Text } from "@lumioui/ui";
import { cn } from "@lumioui/core";
import { Mount, Press, RowIcon, SEPARATOR_INSET, TONE_HEX, type IconTone } from "../shared";
export interface AppearanceScreenProps {
theme?: "system" | "light" | "dark";
onThemeChange?: (theme: "system" | "light" | "dark") => void;
accent?: IconTone;
onAccentChange?: (accent: IconTone) => void;
textScale?: number;
onTextScaleChange?: (scale: number) => void;
onBack?: () => void;
}
const THEMES = [
{ key: "system" as const, label: "System", icon: "settings" as const },
{ key: "light" as const, label: "Light", icon: "sun" as const },
{ key: "dark" as const, label: "Dark", icon: "moon" as const },
];
/** Mini mock canvases — each theme card previews a tiny app surface drawn
* in that scheme, so the picker shows the outcome instead of naming it.
* Raw hex is art direction, like HeroGradient. */
const MOCK = {
light: { bg: "#FFFFFF", surface: "#F2F2F4", bar: "#E4E4E8", text: "#18181B" },
dark: { bg: "#18181B", surface: "#27272A", bar: "#3F3F46", text: "#FAFAFA" },
} as const;
const ACCENTS: { tone: IconTone; swatch: string }[] = [
{ tone: "blue", swatch: "bg-primary" },
{ tone: "green", swatch: "bg-success" },
{ tone: "orange", swatch: "bg-warning" },
{ tone: "purple", swatch: "bg-chart-3" },
{ tone: "teal", swatch: "bg-chart-2" },
];
/** Appearance — theme picker, accent swatches, text size. */
export function AppearanceScreen({
theme = "system",
onThemeChange,
accent = "blue",
onAccentChange,
textScale = 100,
onTextScaleChange,
onBack,
}: AppearanceScreenProps) {
const insets = useSafeAreaInsets();
const [activeTheme, setActiveTheme] = React.useState(theme);
const [activeAccent, setActiveAccent] = React.useState(accent);
const [scale, setScale] = React.useState(textScale);
const [trueBlack, setTrueBlack] = React.useState(false);
const [reduceMotion, setReduceMotion] = React.useState(false);
React.useEffect(() => setActiveTheme(theme), [theme]);
React.useEffect(() => setActiveAccent(accent), [accent]);
React.useEffect(() => setScale(textScale), [textScale]);
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back pill + hug-label title pill. */}
<View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
<View className="flex-row items-center gap-2">
<Glass
effect="regular"
className="h-11 w-11 items-center justify-center rounded-full"
>
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => onBack?.()}
accessibilityLabel="Go back"
className="h-9 w-9"
>
<Icon name="chevron-left" size="md" color="foreground" />
</Button>
</Glass>
</View>
<View pointerEvents="none" className="absolute inset-0 items-center justify-center">
<Glass
effect="regular"
className="h-11 flex-row items-center justify-center rounded-full px-5"
>
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
Appearance
</Text>
</Glass>
</View>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Theme — three mock canvases: pick the look, not the label. */}
<Mount className="px-6 pt-2">
<Text
variant="small"
className="pb-3 font-medium uppercase tracking-widest text-muted-foreground"
accessibilityRole="header"
>
Theme
</Text>
<View className="flex-row gap-3">
{THEMES.map((t) => {
const active = activeTheme === t.key;
return (
<Press
key={t.key}
haptic="light"
pressedScale={0.97}
onPress={() => {
setActiveTheme(t.key);
onThemeChange?.(t.key);
}}
accessibilityRole="radio"
accessibilityState={{ selected: active }}
accessibilityLabel={`${t.label} theme`}
className={cn(
"flex-1 items-center gap-2 overflow-hidden rounded-3xl border-2 p-3",
active ? "border-[#1B1B26]" : "border-transparent"
)}
>
{!active ? (
<Glass interactive effect="clear" sheen={0.5} className="absolute inset-0 rounded-3xl" pointerEvents="none" />
) : null}
{/* Tiny app mock — system splits light/dark diagonally. */}
<View
className="h-20 w-full overflow-hidden rounded-xl"
style={{ flexDirection: "row" }}
accessibilityElementsHidden
importantForAccessibility="no"
>
{(t.key === "system" ? (["light", "dark"] as const) : t.key === "light" ? (["light"] as const) : (["dark"] as const)).map(
(half) => (
<View
key={half}
style={{ flex: 1, backgroundColor: MOCK[half].bg, padding: 8 }}
>
<View style={{ height: 10, width: "60%", borderRadius: 3, backgroundColor: MOCK[half].bar }} />
<View style={{ marginTop: 6, height: 20, borderRadius: 6, backgroundColor: MOCK[half].surface }} />
<View style={{ marginTop: 6, height: 8, width: "80%", borderRadius: 3, backgroundColor: MOCK[half].bar }} />
</View>
)
)}
</View>
<View className="flex-row items-center gap-1.5">
<Icon name={t.icon} size="sm" color={active ? "#1B1B26" : "mutedForeground"} />
<Text
variant="small"
className={active ? "font-semibold text-[#1B1B26]" : "text-muted-foreground"}
>
{t.label}
</Text>
</View>
</Press>
);
})}
</View>
{/* Effective state — System resolves to a concrete mode, not a
mystery. */}
<Text variant="muted" className="pt-2 text-center text-xs">
{activeTheme === "system"
? "Following your device — currently dark until 7:00 AM"
: `${activeTheme === "dark" ? "Dark" : "Light"} mode is always on`}
</Text>
</Mount>
<List inset glass>
<List.Section title="Accent">
<View className="flex-row items-center gap-4 px-4 py-4">
{ACCENTS.map((a) => (
<Button
key={a.tone}
variant="ghost"
haptic="light"
onPress={() => {
setActiveAccent(a.tone);
onAccentChange?.(a.tone);
}}
accessibilityLabel={`${a.tone} accent`}
accessibilityState={{ selected: activeAccent === a.tone }}
className="h-11 w-11 rounded-full p-0"
>
<View
className={cn(
"h-9 w-9 items-center justify-center rounded-full",
a.swatch
)}
>
{activeAccent === a.tone && (
<Icon name="check" size="sm" color="primaryForeground" />
)}
</View>
</Button>
))}
</View>
</List.Section>
<List.Section title="Text size">
<View className="px-4 py-4">
<View className="flex-row items-baseline justify-between pb-3">
<Text variant="small" className="text-muted-foreground">
Body text
</Text>
<Text variant="small" className="text-muted-foreground">
{scale}%
</Text>
</View>
<Slider
value={scale}
onValueChange={(v) => {
setScale(v);
onTextScaleChange?.(v);
}}
min={85}
max={130}
step={5}
accessibilityLabel="Text size"
/>
</View>
</List.Section>
{/* Live preview — the picked accent applied to a mini message
bubble + chip, so accent choice is seen, not imagined. */}
<List.Section title="Preview">
<View className="gap-3 px-4 py-4">
<View className="max-w-[75%] self-start overflow-hidden rounded-2xl rounded-tl-md px-3.5 py-2.5">
<Glass interactive effect="clear" sheen={0.45} className="absolute inset-0 rounded-2xl" pointerEvents="none" />
<Text variant="small">Sent at {scale}% text size</Text>
</View>
<View
className="max-w-[75%] self-end rounded-2xl rounded-br-md px-3.5 py-2.5"
style={{ backgroundColor: TONE_HEX[activeAccent] }}
>
<Text variant="small" className="text-white">
Accents tint bubbles, chips and controls
</Text>
</View>
<View
className="self-start rounded-full px-3 py-1"
style={{ backgroundColor: `${TONE_HEX[activeAccent]}1F` }}
>
<Text className="text-xs font-medium" style={{ color: TONE_HEX[activeAccent] }}>
Accent chip
</Text>
</View>
</View>
</List.Section>
<List.Section title="More">
<List.Item
title="True black dark mode"
subtitle="Pure black surfaces, saves battery"
leading={<RowIcon name="moon" tone="gray" />}
trailing={
<Switch
checked={trueBlack}
onCheckedChange={(v) => setTrueBlack(v)}
accessibilityLabel="True black dark mode"
/>
}
/>
<List.Separator className={SEPARATOR_INSET} />
<List.Item
title="Reduce motion"
subtitle="Tone down springs and transitions"
leading={<RowIcon name="zap" tone="teal" />}
trailing={
<Switch
checked={reduceMotion}
onCheckedChange={(v) => setReduceMotion(v)}
accessibilityLabel="Reduce motion"
/>
}
/>
</List.Section>
</List>
</ScrollView>
</SafeAreaView>
);
}
AppearanceScreen.displayName = "AppearanceScreen";
Recreate the "Appearance Screen" screen in React Native using LumioUI.
Goal: Theme picker, accent swatches, and text-size slider. Match the reference implementation's layout, behavior, and motion exactly — this is a production screen, not a mockup.
## Setup
Fastest path — install the screen plus its component deps:
```bash
npx lumioui add core-appearance
```
Or pull just the components: `npx lumioui add button icon list slider switch text`
Native packages:
- @lumioui/ui@latest
- @lumioui/core@latest
- react-native-safe-area-context@*
- react-native-reanimated@*
- react-native-svg@*
- nativewind@*
Stack assumptions: Expo SDK 54 / RN 0.81, Reanimated 4, NativeWind v4, TypeScript strict, Expo Go compatible.
## Components — how, where, when
### `button` — Tactile pill button with press spring, ink wash and async loading.
- `<Button>` ×2
### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×3
### `list` — Settings-style rows with separators and press feedback.
- `<List>` ×1
### `slider` — Draggable track with haptic ticks and precise thumb.
- `<Slider>` ×1
### `switch` — iOS-size toggle with spring thumb and haptics.
- `<Switch>` ×2
### `text` — Themed type scale from caption to display.
- `<Text>` ×9
## Conventions (non-negotiable)
- Styling via NativeWind `className` with semantic tokens only: `bg-background`, `text-foreground`, `bg-card`, `text-card-foreground`, `bg-secondary`, `bg-muted`, `text-muted-foreground`, `bg-accent`, `bg-destructive`, `border-border`. Hard-coded colors only inside media overlays (`text-white`, `bg-black/N`).
- Motion via the token presets from `@lumioui/core` (`spring.press`, `spring.surface`, `spring.glide`, `timing.fast`, `timing.slow`, …) — no bespoke spring configs or durations.
- Gate transform motion behind `useReducedMotion()`; keep opacity/color feedback, drop travel and overshoot.
- Haptics via `useHaptic()`: `light` on press, `selection` on toggle/select, `warning` on invalid input. Never import expo-haptics directly.
- Press feedback via `usePressAnimation()` (~0.97 scale), not `activeOpacity` tricks.
- a11y: `accessibilityRole` + `accessibilityLabel` on every control, touch targets ≥44pt.
- Entrance choreography: staggered `Mount` wrappers (delay 0/60/120…) so regions land in sequence instead of popping in at once.
- Wrap the screen in `SafeAreaView`; keep dark mode working via the semantic tokens.
## Deliverable
One file: `screens/core/appearance.tsx` exporting AppearanceScreen. Preserve the props interface — the host app wires the callbacks (navigation, submit handlers) through them.
## Reference implementation
The LumioUI source for this screen — reproduce it faithfully:
```tsx
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, List, Slider, Switch, Text } from "@lumioui/ui";
import { cn } from "@lumioui/core";
import { Mount, Press, RowIcon, SEPARATOR_INSET, TONE_HEX, type IconTone } from "../shared";
export interface AppearanceScreenProps {
theme?: "system" | "light" | "dark";
onThemeChange?: (theme: "system" | "light" | "dark") => void;
accent?: IconTone;
onAccentChange?: (accent: IconTone) => void;
textScale?: number;
onTextScaleChange?: (scale: number) => void;
onBack?: () => void;
}
const THEMES = [
{ key: "system" as const, label: "System", icon: "settings" as const },
{ key: "light" as const, label: "Light", icon: "sun" as const },
{ key: "dark" as const, label: "Dark", icon: "moon" as const },
];
/** Mini mock canvases — each theme card previews a tiny app surface drawn
* in that scheme, so the picker shows the outcome instead of naming it.
* Raw hex is art direction, like HeroGradient. */
const MOCK = {
light: { bg: "#FFFFFF", surface: "#F2F2F4", bar: "#E4E4E8", text: "#18181B" },
dark: { bg: "#18181B", surface: "#27272A", bar: "#3F3F46", text: "#FAFAFA" },
} as const;
const ACCENTS: { tone: IconTone; swatch: string }[] = [
{ tone: "blue", swatch: "bg-primary" },
{ tone: "green", swatch: "bg-success" },
{ tone: "orange", swatch: "bg-warning" },
{ tone: "purple", swatch: "bg-chart-3" },
{ tone: "teal", swatch: "bg-chart-2" },
];
/** Appearance — theme picker, accent swatches, text size. */
export function AppearanceScreen({
theme = "system",
onThemeChange,
accent = "blue",
onAccentChange,
textScale = 100,
onTextScaleChange,
onBack,
}: AppearanceScreenProps) {
const insets = useSafeAreaInsets();
const [activeTheme, setActiveTheme] = React.useState(theme);
const [activeAccent, setActiveAccent] = React.useState(accent);
const [scale, setScale] = React.useState(textScale);
const [trueBlack, setTrueBlack] = React.useState(false);
const [reduceMotion, setReduceMotion] = React.useState(false);
React.useEffect(() => setActiveTheme(theme), [theme]);
React.useEffect(() => setActiveAccent(accent), [accent]);
React.useEffect(() => setScale(textScale), [textScale]);
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back pill + hug-label title pill. */}
<View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
<View className="flex-row items-center gap-2">
<Glass
effect="regular"
className="h-11 w-11 items-center justify-center rounded-full"
>
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => onBack?.()}
accessibilityLabel="Go back"
className="h-9 w-9"
>
<Icon name="chevron-left" size="md" color="foreground" />
</Button>
</Glass>
</View>
<View pointerEvents="none" className="absolute inset-0 items-center justify-center">
<Glass
effect="regular"
className="h-11 flex-row items-center justify-center rounded-full px-5"
>
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
Appearance
</Text>
</Glass>
</View>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Theme — three mock canvases: pick the look, not the label. */}
<Mount className="px-6 pt-2">
<Text
variant="small"
className="pb-3 font-medium uppercase tracking-widest text-muted-foreground"
accessibilityRole="header"
>
Theme
</Text>
<View className="flex-row gap-3">
{THEMES.map((t) => {
const active = activeTheme === t.key;
return (
<Press
key={t.key}
haptic="light"
pressedScale={0.97}
onPress={() => {
setActiveTheme(t.key);
onThemeChange?.(t.key);
}}
accessibilityRole="radio"
accessibilityState={{ selected: active }}
accessibilityLabel={`${t.label} theme`}
className={cn(
"flex-1 items-center gap-2 overflow-hidden rounded-3xl border-2 p-3",
active ? "border-[#1B1B26]" : "border-transparent"
)}
>
{!active ? (
<Glass interactive effect="clear" sheen={0.5} className="absolute inset-0 rounded-3xl" pointerEvents="none" />
) : null}
{/* Tiny app mock — system splits light/dark diagonally. */}
<View
className="h-20 w-full overflow-hidden rounded-xl"
style={{ flexDirection: "row" }}
accessibilityElementsHidden
importantForAccessibility="no"
>
{(t.key === "system" ? (["light", "dark"] as const) : t.key === "light" ? (["light"] as const) : (["dark"] as const)).map(
(half) => (
<View
key={half}
style={{ flex: 1, backgroundColor: MOCK[half].bg, padding: 8 }}
>
<View style={{ height: 10, width: "60%", borderRadius: 3, backgroundColor: MOCK[half].bar }} />
<View style={{ marginTop: 6, height: 20, borderRadius: 6, backgroundColor: MOCK[half].surface }} />
<View style={{ marginTop: 6, height: 8, width: "80%", borderRadius: 3, backgroundColor: MOCK[half].bar }} />
</View>
)
)}
</View>
<View className="flex-row items-center gap-1.5">
<Icon name={t.icon} size="sm" color={active ? "#1B1B26" : "mutedForeground"} />
<Text
variant="small"
className={active ? "font-semibold text-[#1B1B26]" : "text-muted-foreground"}
>
{t.label}
</Text>
</View>
</Press>
);
})}
</View>
{/* Effective state — System resolves to a concrete mode, not a
mystery. */}
<Text variant="muted" className="pt-2 text-center text-xs">
{activeTheme === "system"
? "Following your device — currently dark until 7:00 AM"
: `${activeTheme === "dark" ? "Dark" : "Light"} mode is always on`}
</Text>
</Mount>
<List inset glass>
<List.Section title="Accent">
<View className="flex-row items-center gap-4 px-4 py-4">
{ACCENTS.map((a) => (
<Button
key={a.tone}
variant="ghost"
haptic="light"
onPress={() => {
setActiveAccent(a.tone);
onAccentChange?.(a.tone);
}}
accessibilityLabel={`${a.tone} accent`}
accessibilityState={{ selected: activeAccent === a.tone }}
className="h-11 w-11 rounded-full p-0"
>
<View
className={cn(
"h-9 w-9 items-center justify-center rounded-full",
a.swatch
)}
>
{activeAccent === a.tone && (
<Icon name="check" size="sm" color="primaryForeground" />
)}
</View>
</Button>
))}
</View>
</List.Section>
<List.Section title="Text size">
<View className="px-4 py-4">
<View className="flex-row items-baseline justify-between pb-3">
<Text variant="small" className="text-muted-foreground">
Body text
</Text>
<Text variant="small" className="text-muted-foreground">
{scale}%
</Text>
</View>
<Slider
value={scale}
onValueChange={(v) => {
setScale(v);
onTextScaleChange?.(v);
}}
min={85}
max={130}
step={5}
accessibilityLabel="Text size"
/>
</View>
</List.Section>
{/* Live preview — the picked accent applied to a mini message
bubble + chip, so accent choice is seen, not imagined. */}
<List.Section title="Preview">
<View className="gap-3 px-4 py-4">
<View className="max-w-[75%] self-start overflow-hidden rounded-2xl rounded-tl-md px-3.5 py-2.5">
<Glass interactive effect="clear" sheen={0.45} className="absolute inset-0 rounded-2xl" pointerEvents="none" />
<Text variant="small">Sent at {scale}% text size</Text>
</View>
<View
className="max-w-[75%] self-end rounded-2xl rounded-br-md px-3.5 py-2.5"
style={{ backgroundColor: TONE_HEX[activeAccent] }}
>
<Text variant="small" className="text-white">
Accents tint bubbles, chips and controls
</Text>
</View>
<View
className="self-start rounded-full px-3 py-1"
style={{ backgroundColor: `${TONE_HEX[activeAccent]}1F` }}
>
<Text className="text-xs font-medium" style={{ color: TONE_HEX[activeAccent] }}>
Accent chip
</Text>
</View>
</View>
</List.Section>
<List.Section title="More">
<List.Item
title="True black dark mode"
subtitle="Pure black surfaces, saves battery"
leading={<RowIcon name="moon" tone="gray" />}
trailing={
<Switch
checked={trueBlack}
onCheckedChange={(v) => setTrueBlack(v)}
accessibilityLabel="True black dark mode"
/>
}
/>
<List.Separator className={SEPARATOR_INSET} />
<List.Item
title="Reduce motion"
subtitle="Tone down springs and transitions"
leading={<RowIcon name="zap" tone="teal" />}
trailing={
<Switch
checked={reduceMotion}
onCheckedChange={(v) => setReduceMotion(v)}
accessibilityLabel="Reduce motion"
/>
}
/>
</List.Section>
</List>
</ScrollView>
</SafeAreaView>
);
}
AppearanceScreen.displayName = "AppearanceScreen";
```
Screen: https://lumioui.dev/screens/core-appearance