//! Writes the cbz icon set out as Icon Studio documents.
//!
//! These are reconstructions: the background, palette and text mark are taken
//! from the shipped icons, and the glyph names are identified by eye from the
//! same images. Opening one gives you the icon back as an editable document.
use icon_studio::doc::{self, Session};
use icon_studio::palette::NamedColor;
use icon_studio::spec::{Background, Foreground, IconSpec};
fn main() {
let teal = NamedColor { role: "primary", rgb: [0x00, 0xC9, 0xD4] };
let green = NamedColor { role: "accent", rgb: [0xAA, 0xD4, 0x00] };
let ink = NamedColor { role: "base-200", rgb: [0x0D, 0x2A, 0x2C] };
// (file stem, foreground, glyph name for the file comment, scale measured
// from the shipped foreground's ink extents)
let apps: &[(&str, Foreground, f32)] = &[
("cbz-auth", Foreground::Icon('\u{e899}'), 0.54), // lock
("cbz-lists", Foreground::Icon('\u{e85d}'), 0.60), // assignment
("cbz-numerics", Foreground::Text("1234".into()), 0.62),
("cbz-scanner", Foreground::Icon('\u{eb3a}'), 0.62), // satellite_alt
("cbz-inventory", Foreground::Icon('\u{e1a1}'), 0.70), // inventory_2
];
for (stem, fg, scale) in apps {
let session = Session {
spec: IconSpec {
foreground: fg.clone(),
sub_banner: String::new(),
fg_color: ink,
bg_a: teal,
bg_b: green,
background: Background::DiagonalSplit,
angle: 45.0,
scale: *scale,
show_guides: false,
filled: false,
},
palette: "Casabeza".into(),
export_name: "ic_icon".into(),
export_dir: String::new(),
grid_masked: false,
grid_colors: vec!["primary".into(), "accent".into(), "base-200".into()],
grid_backgrounds: vec![Background::Solid, Background::DiagonalSplit],
};
let names = icon_studio::icons::all();
let document = session.to_document(|ch| {
names.iter().filter(|e| e.ch == ch).min_by_key(|e| (e.name.len(), e.name)).map(|e| e.name.to_string()).unwrap_or_default()
});
let path = std::path::Path::new("presets").join(format!("{stem}.toml"));
doc::save(&path, &document).unwrap();
println!("{}", path.display());
}
}
neiam
/icon-studio
public · Issues · Pulls · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
2.4 KiB · text
History
38cca4c