Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# Asset provenance
# Asset provenance

`halation-mark.png` is the Halation logo (Java, 2026-10-22): a hand-drawn vector stroke,
`halation-mark.png` is the Halation logo (Java, 2026-10-22): a hand-drawn vector stroke (one continuous line: an arch, a dip and a hooked rise),
`docs/media/brand/source/halation-mark.svg`, rendered at 512 px by `tools/render-brand.js` (an identity asset, drawn for
this project). `halation-app-icon.png` is the window and taskbar icon from the same script: the mark on a flat
`#111111` rounded square. The static Home reference image is kept outside the source tree under ignored
`.tools/ui-rebuild-native/home-reference/`; it is composition guidance only and is not embedded in the application.

`halation-wordmark.svg` is the HALATION wordmark (one path, identity asset): Bodoni Moda (SIL OFL 1.1) at weight 600,
optical size 60, tracked 0.20 em, converted to outlines (Java's choice, 2026-10-22).
`halation-wordmark-glow.png` is the wordmark's halation glow (960 x 428, the wordmark plus 180 px around it), drawn
from the wordmark by `tools/render-wordmark-glow.js` with Java's settings (2026-10-22).
drawn for this project. `halation-wordmark-glow.png` is its soft white bloom, rendered by `tools/render-wordmark-glow.js`.
`drop-outline.svg` is the dashed outline of Home's drop zone, drawn for this crate.
`fonts/SchibstedGrotesk.ttf` (variable weight, © The Schibsted-Grotesk Project Authors) is the interface face and
`fonts/Italiana.ttf` (© Santiago Orozco, Reserved Font Name "Italiana", unmodified) the page-title face; both SIL Open
Font License 1.1, from the Google Fonts repository.
`fonts/Inter.ttf` is the Inter typeface (variable weight, Latin subset), SIL Open Font License 1.1, © The Inter
Project Authors (https://github.com/rsms/inter); the original app uses the same typeface.

`drape-loop.mp4`, `drape-tint.bin` and `drape-still.jpg` are recordings of the original Halation's Drape background:
a seamless two-minute loop of 1800 frames of 320 x 180 at 15 fps stored as lifted luma in H.264, the colour of each
Expand Down
Binary file added assets/halation-app-icon.ico
Binary file not shown.
Binary file modified assets/halation-app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/halation-mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions crates/halation-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ diag-skia-vulkan = ["slint/renderer-skia-vulkan"]

[build-dependencies]
slint-build = { version = "=1.18.1", default-features = false, features = ["compat-1-18"] }
# The Windows executable's icon and version resources (build.rs); it finds rc.exe in the Windows SDK
embed-resource = "=3.0.11"

[dev-dependencies]
# Headless UI tests (layout bounds at small window sizes); test builds only, never part of the shipped binary.
Expand Down
29 changes: 29 additions & 0 deletions crates/halation-app/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fn main() {
}

copy_assets();
embed_windows_icon();

let sha = git_output(&["rev-parse", "--short=12", "HEAD"])
.filter(|sha| !sha.is_empty())
Expand All @@ -36,6 +37,34 @@ fn main() {
.expect("the Slint UI must compile; fix the reported .slint diagnostics");
}

/// The window and taskbar icon (the mark on #111111, `tools/render-brand.js`) is also a resource of the executable:
/// Explorer and the taskbar read it before the window exists, and it is the icon of a shortcut or a pinned app.
fn embed_windows_icon() {
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {
return;
}
let icon = PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap_or_default())
.join("../../assets/halation-app-icon.ico");
if !icon.is_file() {
println!(
"cargo:warning=assets/halation-app-icon.ico is missing; run node tools/render-brand.js"
);
return;
}
println!("cargo:rerun-if-changed={}", icon.display());
let script = PathBuf::from(std::env::var_os("OUT_DIR").unwrap_or_default()).join("halation.rc");
// Forward slashes: rc.exe reads `\t` in a quoted path as an escape (and this tree lives under `\trrax`)
let source = format!(
"1 ICON \"{}\"\n",
icon.display().to_string().replace('\\', "/")
);
std::fs::write(&script, source).expect("the icon resource script must be written");
// Only the app binary carries the icon; test and benchmark executables do not need it.
embed_resource::compile_for(&script, ["halation-slint"], embed_resource::NONE)
.manifest_optional()
.expect("the icon resource must compile (rc.exe comes with the Windows SDK)");
}

/// Development builds run from `target/<profile>`: put a copy of the workspace's `assets/` next to the executable there,
/// as the installer does beside the installed one. Only changed files are copied.
fn copy_assets() {
Expand Down
2 changes: 1 addition & 1 deletion docs/media/brand/halation-app-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/media/brand/halation-mark-source.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/media/brand/halation-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/media/brand/source/halation-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 67 additions & 7 deletions tools/render-brand.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// - assets/halation-mark.png (512 px): the transparent mark.
// - assets/halation-app-icon.png (256 px): the window and taskbar icon, the mark at 62% on a flat #111111 rounded
// square (the interface's surface grey) with an 8% white hairline.
// - assets/halation-app-icon.ico: the same icon at 16, 24, 32, 48 and 256 px, embedded in the Windows executable
// (crates/halation-app/build.rs) and used for the window and taskbar.
// - docs/media/brand/: halation-mark.svg (the source), halation-app-icon.svg, halation-mark-source.png (the mark PNG).
//
// Usage: node tools/render-brand.js (CHROME and NODE_PATH as needed for Playwright)
Expand All @@ -14,6 +16,7 @@ const { chromium } = require("playwright");

const MARK_PNG = 512;
const ICON_PNG = 256;
const ICO_SIZES = [16, 24, 32, 48, 256];
// Share of the square the mark spans
const SPAN = 0.62;

Expand All @@ -37,7 +40,7 @@ function iconSvg() {
}

async function rasterize(page, svg, size) {
const base64 = await page.evaluate(
const { png, rgba } = await page.evaluate(
async ({ svg, size }) => {
const image = new Image();
image.src = "data:image/svg+xml;base64," + btoa(svg);
Expand All @@ -47,11 +50,62 @@ async function rasterize(page, svg, size) {
const context = canvas.getContext("2d");
context.imageSmoothingQuality = "high";
context.drawImage(image, 0, 0, size, size);
return canvas.toDataURL("image/png").split(",")[1];
return {
png: canvas.toDataURL("image/png").split(",")[1],
rgba: Array.from(context.getImageData(0, 0, size, size).data),
};
},
{ svg, size },
);
return Buffer.from(base64, "base64");
return { png: Buffer.from(png, "base64"), rgba: Buffer.from(rgba) };
}

// One 32-bit bottom-up DIB, the icon format Windows reads without a PNG decoder. The height in the header is twice the
// icon's because the AND mask that follows counts too; the mask is fully transparent (the alpha channel already says
// which pixels show).
function bmpEntry(size, rgba) {
const header = Buffer.alloc(40);
header.writeUInt32LE(40, 0);
header.writeInt32LE(size, 4);
header.writeInt32LE(size * 2, 8);
header.writeUInt16LE(1, 12);
header.writeUInt16LE(32, 14);
header.writeUInt32LE(size * size * 4, 20);
const pixels = Buffer.alloc(size * size * 4);
for (let y = 0; y < size; y += 1) {
for (let x = 0; x < size; x += 1) {
const source = (y * size + x) * 4;
const target = ((size - 1 - y) * size + x) * 4;
pixels[target] = rgba[source + 2];
pixels[target + 1] = rgba[source + 1];
pixels[target + 2] = rgba[source];
pixels[target + 3] = rgba[source + 3];
}
}
const maskStride = ((size + 31) >> 5) * 4;
return Buffer.concat([header, pixels, Buffer.alloc(maskStride * size)]);
}

// A Windows .ico: a directory of images at the sizes Explorer, the taskbar and Alt+Tab ask for. PNG compresses the
// 256 px entry (Vista and later read it); the smaller ones stay plain DIBs, the format every Windows version reads.
function ico(entries) {
const header = Buffer.alloc(6);
header.writeUInt16LE(0, 0);
header.writeUInt16LE(1, 2);
header.writeUInt16LE(entries.length, 4);
const directory = Buffer.alloc(16 * entries.length);
let offset = header.length + directory.length;
entries.forEach(({ size, data }, index) => {
const entry = index * 16;
directory.writeUInt8(size === 256 ? 0 : size, entry);
directory.writeUInt8(size === 256 ? 0 : size, entry + 1);
directory.writeUInt16LE(1, entry + 4);
directory.writeUInt16LE(32, entry + 6);
directory.writeUInt32LE(data.length, entry + 8);
directory.writeUInt32LE(offset, entry + 12);
offset += data.length;
});
return Buffer.concat([header, directory, ...entries.map(({ data }) => data)]);
}

async function main() {
Expand All @@ -60,15 +114,21 @@ async function main() {
try {
const page = await browser.newPage();
const mark = await rasterize(page, markSvg, MARK_PNG);
fs.writeFileSync(path.join(root, "assets", "halation-mark.png"), mark);
fs.writeFileSync(path.join(root, "assets", "halation-app-icon.png"), await rasterize(page, icon, ICON_PNG));
fs.writeFileSync(path.join(brand, "halation-mark-source.png"), mark);
fs.writeFileSync(path.join(root, "assets", "halation-mark.png"), mark.png);
fs.writeFileSync(path.join(root, "assets", "halation-app-icon.png"), (await rasterize(page, icon, ICON_PNG)).png);
const entries = [];
for (const size of ICO_SIZES) {
const image = await rasterize(page, icon, size);
entries.push({ size, data: size === 256 ? image.png : bmpEntry(size, image.rgba) });
}
fs.writeFileSync(path.join(root, "assets", "halation-app-icon.ico"), ico(entries));
fs.writeFileSync(path.join(brand, "halation-mark-source.png"), mark.png);
fs.writeFileSync(path.join(brand, "halation-mark.svg"), markSvg);
fs.writeFileSync(path.join(brand, "halation-app-icon.svg"), icon);
} finally {
await browser.close();
}
console.log("wrote assets/halation-mark.png, assets/halation-app-icon.png and docs/media/brand/");
console.log("wrote assets/halation-mark.png, assets/halation-app-icon.png, assets/halation-app-icon.ico and docs/media/brand/");
}

main().catch((error) => {
Expand Down
Loading