Skip to main content

geometry_css_vars

Function geometry_css_vars 

Source
pub fn geometry_css_vars(density: Density) -> String
Expand description

Emit the whole geometry layer as a :root { … } block at one density.

Mirrors makeover::intent_css_vars. Unlike the colour layer this is constant, so a web consumer should bake it in at build time rather than apply it from JS on every load.

Examples found in repository?
examples/dump.rs (line 7)
6fn main() {
7    print!("{}", geometry_css_vars(Density::Pointer));
8    println!();
9    print!("{}", gap_css_overrides(".ui-mode-mobile", Density::Touch));
10
11    println!("\n/* the same relationships on a terminal, in cells */");
12    let t = Surface::terminal();
13    for gap in Gap::all() {
14        println!(
15            "/*   {:<8} {} */",
16            gap.token().trim_start_matches("gap-"),
17            t.gap(gap, Density::Pointer)
18        );
19    }
20}