T24: the icon, Ely holding a terminal, drawn in SVG: on macOS's rounded square, and alone and flat for Windows and Linux; scripts/mac-app.sh builds ELYTerminal.app, signed ad hoc, and its disk image, its icon rendered by examples/icons.rs through resvg
CI / platforms (windows-latest) (push) Successful in 2m40s
CI / platforms (ubuntu-24.04) (push) Successful in 3m41s
CI / macos (push) Canceled after 0s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-15 15:10:17 -04:00
1 parent c0a9eb3c98
commit 67fe91249a
11 files changed
+253

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
//! Renders an SVG into a macOS iconset: `icons SVG FOLDER`.
use std::path::Path;
use anyhow::Context as _;
use resvg::{tiny_skia, usvg};
fn main() -> anyhow::Result<()> {
let mut args = std::env::args().skip(1);
let svg = args.next().context("icons: name an SVG to render")?;
let out = args
.next()
.context("icons: name an iconset folder to write")?;
let data = std::fs::read(&svg).with_context(|| format!("icons: cannot read {svg}"))?;
let tree = usvg::Tree::from_data(&data, &usvg::Options::default())
.with_context(|| format!("icons: {svg} is not an SVG"))?;
std::fs::create_dir_all(&out).with_context(|| format!("icons: cannot make {out}"))?;
for points in [16, 32, 128, 256, 512] {
for (scale, suffix) in [(1, ""), (2, "@2x")] {
let side = points * scale;
let mut pixmap = tiny_skia::Pixmap::new(side, side).context("icons: no pixmap")?;
let fit = side as f32 / tree.size().width();
let transform = tiny_skia::Transform::from_scale(fit, fit);
resvg::render(&tree, transform, &mut pixmap.as_mut());
let png = Path::new(&out).join(format!("icon_{points}x{points}{suffix}.png"));
pixmap
.save_png(&png)
.with_context(|| format!("icons: cannot write {}", png.display()))?;
}
}
println!("icons: {svg} drawn into {out}");
Ok(())
}