Skip to main content

gap_css_overrides

Function gap_css_overrides 

Source
pub fn gap_css_overrides(selector: &str, density: Density) -> String
Expand description

Emit a density preset as a scoped override block.

Only the relational layer is emitted: the scale and the base do not change between presets, so an app ships geometry_css_vars at its default density and one of these per mode class it supports.

let css = gap_css_overrides(".ui-mode-mobile", Density::Touch);
assert!(css.starts_with(".ui-mode-mobile {\n"));
Examples found in repository?
examples/dump.rs (line 9)
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}