Theming
Adapt every Vitrum component and custom `<GlassSurface>` to your brand with `<VitrumProvider>`, 5 curated glass presets, `createGlassTheme()`, and `--vitrum-*` CSS variables.
Frost
blur 5px · refract 1× · fluid
Built-in presets
- `frost` (default) — balanced neutral refractive glass for light and dark interfaces.
- `obsidian` — deep high-contrast dark smoked glass with crisp specular rims.
- `aurora` — iridescent cool-cyan/violet refractive tint with fluid springs.
- `amber` — warm golden-hour architectural glass with gentle motion.
- `crystal` — ultra-clear high-refraction optical glass with minimal frost.
Wrapping your app
Wrap your root layout (or any subtree) in <VitrumProvider>. Standalone components used outside <VitrumProvider> keep their exact v1.0 defaults without needing any provider.
import '@vitrumui/react/styles.css'
import { VitrumProvider } from '@vitrumui/react/theme'
export function Providers({ children }: { children: React.ReactNode }) {
return (
<VitrumProvider theme="aurora" colorScheme="system">
{children}
</VitrumProvider>
)
}Custom brand themes
import { createGlassTheme, VitrumProvider } from '@vitrumui/react/theme'
const brandGlass = createGlassTheme(
{
name: 'brand-indigo',
tint: '#e0e7ff',
tintOpacity: 0.55,
blur: 7,
refraction: 1.2,
specular: 1.3,
motionPreset: 'snappy',
dark: { tint: '#1e1b4b', tintOpacity: 0.7 },
},
'frost',
)
<VitrumProvider theme={brandGlass}>{children}</VitrumProvider>Reading & switching themes
import { useVitrumTheme, VITRUM_THEME_NAMES } from '@vitrumui/react/theme'
export function ThemeSwitcher() {
const { theme, resolvedColorScheme, setTheme, setColorScheme } = useVitrumTheme()
return (
<button onClick={() => setTheme(theme.name === 'frost' ? 'obsidian' : 'frost')}>
Active: {theme.name} ({resolvedColorScheme})
</button>
)
}CSS custom properties
@vitrumui/react/styles.css defines :root defaults and <VitrumProvider> scopes --vitrum-tint, --vitrum-tint-opacity, --vitrum-blur, --vitrum-refraction, --vitrum-specular, --vitrum-rim-light, --vitrum-shadow-strength, --vitrum-border-opacity, --vitrum-radius-scale, and --vitrum-motion onto its subtree.
API reference
| Prop | Type | Default |
|---|---|---|
themeBuilt-in preset name or custom theme created with | 'frost' | 'obsidian' | 'aurora' | 'amber' | 'crystal' | VitrumTheme | 'frost' |
colorSchemeSynchronises dark-mode glass optics automatically with system / | 'system' | 'light' | 'dark' | 'system' |
applyToRootMirrors active | boolean | false |
useVitrumTheme()Hook to inspect or switch the active glass theme and colour scheme. | { theme, resolvedColorScheme, setTheme, setColorScheme, cssVars } | — |