App icon: full rounded tile on Windows and Linux (#159)

The hicolor theme, the .ico and the window icon now show the whole tile with its rounded
corners, like the other Crafting Apps, instead of a crop that cut most of the corners off.
This commit is contained in:
BFlat authored and GitHub committed 2026-10-12 15:26:54 +07:00
1 parent 8df9998044
commit 76929f63ce
11 files changed
+8 -11

No files matched your search

+1 -1
View File
@@ -210,7 +210,7 @@ impl Services for Desktop {
/// The window icon from the bundled app icon (if present).
pub fn window_icon() -> Option<egui::IconData> {
// macOS wants Apple's padded grid; the other platforms the tile edge to edge.
// macOS wants Apple's padded grid; the other platforms the rounded tile edge to edge.
#[cfg(target_os = "macos")]
let bytes = include_bytes!("../../../assets/app-icon/figcraft-256.png");
#[cfg(not(target_os = "macos"))]
+2 -2
View File
@@ -16,8 +16,8 @@ Exactly three colours:
## Geometry
A 512-unit tile (`viewBox="0 0 512 512"`), rounded square with `rx=112`, no border. The macOS
renders pad it onto Apple's 824/1024 icon grid; the Windows and Linux renders crop 22 units off
each side so the figure reads at 16–48 px.
renders pad it onto Apple's 824/1024 icon grid; Windows and Linux use the tile edge to edge, with
its rounded corners, like the other Crafting Apps.
## Provenance
Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 779 B

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

+5 -8
View File
@@ -9,8 +9,6 @@ use std::process::Command;
const VIEW_BOX: &str = r#"viewBox="0 0 512 512""#;
/// macOS: the 512-unit tile padded onto Apple's 824/1024 icon grid (transparent margin).
const MAC_VIEW_BOX: &str = r#"viewBox="-62 -62 636 636""#;
/// Windows and Linux: 22 units cropped off each side so the portrait reads at 16-48 px.
const TIGHT_VIEW_BOX: &str = r#"viewBox="22 22 468 468""#;
fn render(svg: &Path, size: u32, out: &Path) -> bool {
let s = size.to_string();
@@ -32,10 +30,9 @@ pub fn generate(root: &Path) -> bool {
return false;
}
let tmp = root.join("target/icon");
let (mac, tight) = (tmp.join("mac.svg"), tmp.join("tight.svg"));
let mut ok = std::fs::create_dir_all(&tmp).is_ok()
&& std::fs::write(&mac, master.replacen(VIEW_BOX, MAC_VIEW_BOX, 1)).is_ok()
&& std::fs::write(&tight, master.replacen(VIEW_BOX, TIGHT_VIEW_BOX, 1)).is_ok();
// Windows and Linux show the tile edge to edge, rounded corners and all: the master as it is.
let (mac, tile) = (tmp.join("mac.svg"), dir.join("figcraft.svg"));
let mut ok = std::fs::create_dir_all(&tmp).is_ok() && std::fs::write(&mac, master.replacen(VIEW_BOX, MAC_VIEW_BOX, 1)).is_ok();
if !ok {
eprintln!("icon: cannot write {}", tmp.display());
return false;
@@ -45,7 +42,7 @@ pub fn generate(root: &Path) -> bool {
if size <= 512 {
let hd = dir.join(format!("hicolor/{size}x{size}/apps"));
let _ = std::fs::create_dir_all(&hd);
ok &= render(&tight, size, &hd.join("ai.storyteller.figcraft.png"));
ok &= render(&tile, size, &hd.join("ai.storyteller.figcraft.png"));
}
}
// Windows .ico (PNG-compressed entries).
@@ -54,7 +51,7 @@ pub fn generate(root: &Path) -> bool {
.iter()
.filter_map(|s| {
let png = tmp.join(format!("ico-{s}.png"));
render(&tight, *s, &png).then(|| std::fs::read(png).ok()).flatten()
render(&tile, *s, &png).then(|| std::fs::read(png).ok()).flatten()
})
.collect();
ok &= pngs.len() == sizes.len();