Temas
Los temas son simples objetos de TypeScript compilados en propiedades personalizadas CSS --z-*. Cambiar de tema reescribe las variables — al instante, sin CSS-in-JS, sin coste de re-render para los estilos.
Temas listos para usar
import { lightTheme, darkTheme, auraTheme, materialTheme } from "@zephora/theme";createTheme
import { createTheme, lightTheme } from "@zephora/theme";
const brand = createTheme(lightTheme, {
name: "brand",
colors: {
primary: "#0f766e",
primaryHover: "#115e59",
ring: "#14b8a6",
},
radius: "0.75rem",
});Scoped frente a global
// Scoped — wraps a subtree in a themed scope element
<ThemeProvider theme={brand}>...</ThemeProvider>
// Global — writes variables onto <html>, ideal for app-level switching
import { applyTheme } from "@zephora/theme";
applyTheme(brand);Sobrescrituras a nivel de CSS
Los componentes leen las variables directamente, así que cualquier regla CSS puede volver a tematizar cualquier subárbol:
.marketing-section {
--z-primary: #ea580c;
--z-radius: 9999px;
}Modo oscuro
const [scheme, setScheme] = useState<"light" | "dark">("light");
<ThemeProvider theme={scheme === "dark" ? darkTheme : lightTheme} global>
<App />
</ThemeProvider>