Skip to main content

css_vars

Macro css_vars 

Source
css_vars!() { /* proc-macro */ }
Expand description

The css_vars! macro for defining CSS custom properties.

Each variable block creates a CssClass function that, when called, injects the CSS custom properties into the DOM. Variable names are automatically prefixed with --.

Variable names can be written as unquoted kebab-case identifiers (e.g., bg-primary) or as quoted string literals (e.g., "bg-primary").

css_vars! {
    pub c_theme_light {
        bg-primary: "#f8f9fb";
        text-primary: "#1a1a2e";
    }
}