Scoped Theming
Use ThemeScope to change the theme or color mode for part of a screen. Content outside the scope keeps the parent theme.
Create an override
Add themeOverride alongside themes in vortex-native.config.ts:
themeOverride: {
rounded: {
componentTokens: {
borderRadius: {
button: { borderRadius: "full" },
},
},
},
},Run your theme script. It creates src/themes/overrides/rounded/theme.native.ts, which contains only the values that differ from the base theme.
Vortex Themes also includes a bundled astra override at @vortexlabs/vortex-themes/themes/overrides/astra/native.
Apply the override
Pass the override to a scope:
import { Stack, ThemeScope } from "@vortexlabs/vortex-native";
import roundedTheme from "./src/themes/overrides/rounded/theme.native";
<ThemeScope theme={roundedTheme}>
<Stack>{children}</Stack>
</ThemeScope>To apply it to the whole app, pass layers to the provider: theme={[acmeTheme, roundedTheme]}. Layers merge left to right, and later values win.
You can also pass resolved values directly, such as theme={{ borderRadius: { button: 24 } }}. Tokens that reference a changed value update too: overriding palette.brandPrimary600 changes every semantic color that uses it.
Scope the color mode
Omit colorMode to inherit the parent's mode. Set a fixed mode or invert the parent:
<ThemeScope colorMode="dark">
<Text>Always dark</Text>
</ThemeScope>
<ThemeScope colorMode="inverted">
<Text>Opposite color mode</Text>
</ThemeScope>Nested inverted scopes alternate modes. ThemeScope doesn't render a view, so add a themed View for the background; see Theme the screen background.
setColorMode and invertColorMode from useTheme still target the provider, so a fixed scope stays dark while the provider changes. For independent color-mode state, nest another VortexProvider with its own theme.