Thèmes
Les thèmes sont de simples objets TypeScript compilés en propriétés personnalisées CSS --z-*. Changer de thème réécrit les variables — instantanément, sans CSS-in-JS, sans coût de re-render pour les styles.
Thèmes prêts à l'emploi
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 ou 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);Surcharges au niveau CSS
Les composants lisent directement les variables, donc n'importe quelle règle CSS peut re-thématiser n'importe quel sous-arbre :
.marketing-section {
--z-primary: #ea580c;
--z-radius: 9999px;
}Mode sombre
const [scheme, setScheme] = useState<"light" | "dark">("light");
<ThemeProvider theme={scheme === "dark" ? darkTheme : lightTheme} global>
<App />
</ThemeProvider>