829 B · text History af1c436
//! Renders Icon Studio's own desktop icon — from a document, with the studio's
//! own renderer, so the tool eats its own cooking and the icon stays editable.

use icon_studio::doc::{self, Session};

/// Sizes the freedesktop hicolor theme looks in.
const SIZES: &[u32] = &[48, 64, 128, 256];

fn main() {
    let path = std::path::Path::new("presets/icon-studio.toml");
    let document = doc::load(path).unwrap_or_else(|e| panic!("{e}"));
    let session = Session::from_document(&document).unwrap_or_else(|e| panic!("{e}"));

    std::fs::create_dir_all("assets/icons").unwrap();
    for size in SIZES {
        let out = format!("assets/icons/icon-studio-{size}.png");
        icon_studio::render::render_composed(&session.spec, *size)
            .save_png(&out)
            .unwrap();
        println!("{out}");
    }
}