Skip to main content

var

Macro var 

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

The var! macro for referencing CSS custom properties defined via css_vars!.

The variable name can be written as an unquoted kebab-case identifier (e.g., bg-primary) or as a quoted string literal (e.g., "bg-primary"), and expands to the CSS string "var(--bg-primary)".

css_vars! {
    pub c_theme {
        bg-primary: "#f8f9fb";
    }
}
class! {
    pub c_container {
        background: var!(bg-primary);
    }
}