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.
No files matched your search
@@ -210,7 +210,7 @@ impl Services for Desktop {
|
|||||||
|
|
||||||
/// The window icon from the bundled app icon (if present).
|
/// The window icon from the bundled app icon (if present).
|
||||||
pub fn window_icon() -> Option<egui::IconData> {
|
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")]
|
#[cfg(target_os = "macos")]
|
||||||
let bytes = include_bytes!("../../../assets/app-icon/figcraft-256.png");
|
let bytes = include_bytes!("../../../assets/app-icon/figcraft-256.png");
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ Exactly three colours:
|
|||||||
## Geometry
|
## Geometry
|
||||||
|
|
||||||
A 512-unit tile (`viewBox="0 0 512 512"`), rounded square with `rx=112`, no border. The macOS
|
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
|
renders pad it onto Apple's 824/1024 icon grid; Windows and Linux use the tile edge to edge, with
|
||||||
each side so the figure reads at 16–48 px.
|
its rounded corners, like the other Crafting Apps.
|
||||||
|
|
||||||
## Provenance
|
## Provenance
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 779 B After Width: | Height: | Size: 825 B |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 178 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.8 KiB |
@@ -9,8 +9,6 @@ use std::process::Command;
|
|||||||
const VIEW_BOX: &str = r#"viewBox="0 0 512 512""#;
|
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).
|
/// 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""#;
|
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 {
|
fn render(svg: &Path, size: u32, out: &Path) -> bool {
|
||||||
let s = size.to_string();
|
let s = size.to_string();
|
||||||
@@ -32,10 +30,9 @@ pub fn generate(root: &Path) -> bool {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let tmp = root.join("target/icon");
|
let tmp = root.join("target/icon");
|
||||||
let (mac, tight) = (tmp.join("mac.svg"), tmp.join("tight.svg"));
|
// Windows and Linux show the tile edge to edge, rounded corners and all: the master as it is.
|
||||||
let mut ok = std::fs::create_dir_all(&tmp).is_ok()
|
let (mac, tile) = (tmp.join("mac.svg"), dir.join("figcraft.svg"));
|
||||||
&& std::fs::write(&mac, master.replacen(VIEW_BOX, MAC_VIEW_BOX, 1)).is_ok()
|
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();
|
|
||||||
if !ok {
|
if !ok {
|
||||||
eprintln!("icon: cannot write {}", tmp.display());
|
eprintln!("icon: cannot write {}", tmp.display());
|
||||||
return false;
|
return false;
|
||||||
@@ -45,7 +42,7 @@ pub fn generate(root: &Path) -> bool {
|
|||||||
if size <= 512 {
|
if size <= 512 {
|
||||||
let hd = dir.join(format!("hicolor/{size}x{size}/apps"));
|
let hd = dir.join(format!("hicolor/{size}x{size}/apps"));
|
||||||
let _ = std::fs::create_dir_all(&hd);
|
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).
|
// Windows .ico (PNG-compressed entries).
|
||||||
@@ -54,7 +51,7 @@ pub fn generate(root: &Path) -> bool {
|
|||||||
.iter()
|
.iter()
|
||||||
.filter_map(|s| {
|
.filter_map(|s| {
|
||||||
let png = tmp.join(format!("ico-{s}.png"));
|
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();
|
.collect();
|
||||||
ok &= pngs.len() == sizes.len();
|
ok &= pngs.len() == sizes.len();
|
||||||
|
|||||||