// cosmic-theme 1.0.0, the part of it that does not depend on `palette`. // // `corner.rs`, `spacing.rs` and `layout.rs` are the crate's own files, // byte-for-byte. They are the spacing scale, corner radii and density model // that a COSMIC-native UI needs in order to match the desktop. The rest of // cosmic-theme is colour work built on `palette` (40,874 lines, plus a // proc-macro crate), which is out of reach. mod corner; mod layout; mod spacing; use crate::corner::{CornerRadii, Roundness}; use crate::spacing::{Density, Spacing}; fn show_spacing(tag: &str, s: Spacing) { println!( "{} {} {} {} {} {} {} {} {} {} {}", tag, s.space_none, s.space_xxxs, s.space_xxs, s.space_xs, s.space_s, s.space_m, s.space_l, s.space_xl, s.space_xxl, s.space_xxxl ); } fn show_corner(tag: &str, c: CornerRadii) { println!( "{} {} {} {} {} {} {}", tag, c.radius_0[0], c.radius_xs[0], c.radius_s[0], c.radius_m[0], c.radius_l[0], c.radius_xl[0] ); } fn main() { show_spacing("default", Spacing::default()); show_spacing("compact", Spacing::from(Density::Compact)); show_spacing("spacious", Spacing::from(Density::Spacious)); show_spacing("standard", Spacing::from(Density::Standard)); // Density round-trips through Spacing. for d in [Density::Compact, Density::Spacious, Density::Standard] { let s: Spacing = Spacing::from(d); let back: Density = Density::from(s); println!("roundtrip {:?} -> {:?}", d, back); } show_corner("default", CornerRadii::default()); for r in [Roundness::Round, Roundness::SlightlyRound, Roundness::Square] { let c: CornerRadii = CornerRadii::from(r); let back: Roundness = Roundness::from(c); println!("corner {:?} -> {:?}", r, back); show_corner(" radii", CornerRadii::from(r)); } }