Give Horizon a mark, and its icon everywhere

The mark is an H whose crossbar is the horizon: a violet line edge to edge, the stems above it
and their reflection below at a third, on whole units of a 16-unit grid so it stays sharp at
16 px. docs/media/brand holds the SVG masters (square icon, macOS tile, avatars, the mark for
light and dark backgrounds), the two alternatives that were shown with it, the GitHub social
preview and the Discord banner, and a README of what goes where and how to upload what only
Ludovic's accounts can.

`cargo run -p xtask -- icons` renders the masters (rsvg-convert) and packs, in plain Rust:
packaging/icons/horizon.ico and horizon.icns, Linux's hicolor icons 16–512 and the scalable
SVG, the game's run-time window icon, the avatars and the website's favicons.
packaging/linux has .desktop entries for the launcher and the game.

On Windows, build.rs embeds the .ico as icon resource 1 in horizon-client (and its tools) and
horizon-launcher (winresource, a Windows-only build dependency); gpui loads that resource as
the launcher's window icon. The game window sets the icon itself (X11, Windows) and names
itself `horizon` on Wayland so the desktop entry matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-14 19:59:44 +02:00
parent 7d26cb0a5b
commit fcbbff26a7
46 changed files with 461 additions and 61 deletions
+9 -2
View File
@@ -8199,9 +8199,16 @@ impl ApplicationHandler for Game<'_> {
// The Window constructor: created fullscreen when options.txt says so.
let fullscreen = self.settings.fullscreen;
self.fullscreen = horizon_client::window::FullscreenState::new(fullscreen);
let attributes = Window::default_attributes()
.with_title("Horizon")
.with_window_icon(horizon_client::window::icon());
// Wayland names the window by its app id, which the horizon.desktop entry matches.
#[cfg(target_os = "linux")]
let attributes = winit::platform::wayland::WindowAttributesExtWayland::with_name(
attributes, "horizon", "horizon",
);
let window = match event_loop.create_window(
Window::default_attributes()
.with_title("Horizon")
attributes
.with_inner_size(winit::dpi::LogicalSize::new(1280.0, 720.0))
.with_fullscreen(fullscreen.then_some(winit::window::Fullscreen::Borderless(None))),
) {
+20
View File
@@ -307,10 +307,30 @@ impl FullscreenState {
}
}
/// Horizon's icon for the window's title bar and the task bar (X11 and Windows; Wayland takes
/// it from the `horizon.desktop` entry, macOS from the app bundle). `None` if it can't be read.
pub fn icon() -> Option<winit::window::Icon> {
let mut decoder = png::Decoder::new(std::io::Cursor::new(horizon_theme::ICON_PNG));
decoder.set_transformations(png::Transformations::EXPAND | png::Transformations::STRIP_16);
let mut reader = decoder.read_info().ok()?;
let mut bytes = vec![0; reader.output_buffer_size()?];
let info = reader.next_frame(&mut bytes).ok()?;
if info.color_type != png::ColorType::Rgba {
return None;
}
bytes.truncate(info.buffer_size());
winit::window::Icon::from_rgba(bytes, info.width, info.height).ok()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_window_icon_decodes() {
assert!(icon().is_some());
}
#[test]
fn fullscreen_follows_the_option_only_when_it_changes() {
let mut f = FullscreenState::new(false);