[PR #4176] [MERGED] Launcher: an accent is any hue, not one of seven #5461

Closed
opened 2026-11-03 05:12:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4176
Author: @Domanffe
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-accent-hue


📝 Commits (4)

  • 5b2d5c7 Launcher: an accent is any hue, not one of seven
  • 08c9aa5 Merge origin/main into the accent hue branch
  • 2b2c289 Launcher: the accent a drag leaves off the strip, and the CLI's hue
  • 0ce359e Merge main into #4176

📊 Changes

6 files changed (+228 additions, -56 deletions)

View changed files

📝 launcher/src/backend.rs (+3 -3)
📝 launcher/src/cli.rs (+4 -1)
📝 launcher/src/main.rs (+7 -0)
📝 launcher/src/themes.rs (+75 -44)
📝 launcher/src/themes/tests.rs (+24 -7)
📝 launcher/src/themes_page.rs (+115 -1)

📄 Description

🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself.

Settings > Accent colour offered seven colours and nothing else. The type behind it (themes::Accent) was an enum of seven names, so another colour was not a UI question but a type question, and the seven hues were the whole list for good.

Accent carries a hue now: Option<f32> in degrees, None for Horizon's violet, whose tokens are the palette's own and stay untouched. The seven names stay as constants (Accent::BLUE …) and as the swatches, so a player who wants a coloured accent is one click away; Accent::custom(212.6) is any other. name() answers a named hue's name and a picked hue's degrees; parse() takes either, so settings.json keeps "accent": "teal" for the presets and writes "accent": "341.3793" for a picked one, and the CLI takes both too (horizon-launcher settings accent 212). An accent a future launcher writes still falls back to the violet through the same Settings::parse guard: a value the type refuses is dropped, not fatal.

The picker is a strip of 60 hues beside the swatches, painted in the row (themes_page::hue_strip): a click or a drag sets the accent, and the strip remembers where it is by drawing a 3 px mark at the picked hue. The file is written once, when the mouse comes up, not on every frame of a drag. Choosing a hue that is exactly a preset's selects that swatch, because the values are equal.

Every colour keeps the readability the violet has: apply already darkens or lightens each token until white on the face reaches 4.5:1 and the accent reaches 3:1 on every ground. The test that pins that (every_accent_reads_as_well_as_the_violet) loops the seven presets plus two hues nobody preset (96° and 300°), and a second test pins the round trip: parse("217"), custom(370.) wrapping to 10°, and "217.5" surviving settings.json.

Evidence: built on Windows and looked at (HORIZON_LAUNCHER_HOME on a throwaway folder, HORIZON_LAUNCHER_PAGE=settings, "accent": "154" in settings.json). The row shows the seven swatches and the hue strip with its mark; a pointer down and up on the strip wrote "accent": "341.3793" into settings.json, which is the whole gesture working end to end. What the screenshot of this branch also shows is the language row crushed to one character a line: that is the bug PR #4148 fixes, and this branch is cut from main without it.

cargo test --lib themes (4 tests) and cargo test --lib backend (38) pass; cargo fmt --all --check and cargo clippy --all-targets -- -D warnings are clean. The pr_ready block follows as a comment.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4176 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-accent-hue` --- ### 📝 Commits (4) - [`5b2d5c7`](https://github.com/horizon-rust/horizon/commit/5b2d5c75803a1a118c1f55799cef3757b2f7c1ef) Launcher: an accent is any hue, not one of seven - [`08c9aa5`](https://github.com/horizon-rust/horizon/commit/08c9aa50f273dbfb50ce7d53491fc455299edf55) Merge origin/main into the accent hue branch - [`2b2c289`](https://github.com/horizon-rust/horizon/commit/2b2c2893ef267ba719fa7302f1dac8d2af39c549) Launcher: the accent a drag leaves off the strip, and the CLI's hue - [`0ce359e`](https://github.com/horizon-rust/horizon/commit/0ce359e5a44eb4be88566d47942ec09267bacdda) Merge main into #4176 ### 📊 Changes **6 files changed** (+228 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `launcher/src/backend.rs` (+3 -3) 📝 `launcher/src/cli.rs` (+4 -1) 📝 `launcher/src/main.rs` (+7 -0) 📝 `launcher/src/themes.rs` (+75 -44) 📝 `launcher/src/themes/tests.rs` (+24 -7) 📝 `launcher/src/themes_page.rs` (+115 -1) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. Settings > Accent colour offered seven colours and nothing else. The type behind it (`themes::Accent`) was an enum of seven names, so another colour was not a UI question but a type question, and the seven hues were the whole list for good. `Accent` carries a hue now: `Option<f32>` in degrees, `None` for Horizon's violet, whose tokens are the palette's own and stay untouched. The seven names stay as constants (`Accent::BLUE` …) and as the swatches, so a player who wants a coloured accent is one click away; `Accent::custom(212.6)` is any other. `name()` answers a named hue's name and a picked hue's degrees; `parse()` takes either, so `settings.json` keeps `"accent": "teal"` for the presets and writes `"accent": "341.3793"` for a picked one, and the CLI takes both too (`horizon-launcher settings accent 212`). An `accent` a future launcher writes still falls back to the violet through the same `Settings::parse` guard: a value the type refuses is dropped, not fatal. The picker is a strip of 60 hues beside the swatches, painted in the row (`themes_page::hue_strip`): a click or a drag sets the accent, and the strip remembers where it is by drawing a 3 px mark at the picked hue. The file is written once, when the mouse comes up, not on every frame of a drag. Choosing a hue that is exactly a preset's selects that swatch, because the values are equal. Every colour keeps the readability the violet has: `apply` already darkens or lightens each token until white on the face reaches 4.5:1 and the accent reaches 3:1 on every ground. The test that pins that (`every_accent_reads_as_well_as_the_violet`) loops the seven presets plus two hues nobody preset (96° and 300°), and a second test pins the round trip: `parse("217")`, `custom(370.)` wrapping to 10°, and `"217.5"` surviving `settings.json`. Evidence: built on Windows and looked at (`HORIZON_LAUNCHER_HOME` on a throwaway folder, `HORIZON_LAUNCHER_PAGE=settings`, `"accent": "154"` in `settings.json`). The row shows the seven swatches and the hue strip with its mark; a pointer down and up on the strip wrote `"accent": "341.3793"` into `settings.json`, which is the whole gesture working end to end. What the screenshot of this branch also shows is the language row crushed to one character a line: that is the bug PR #4148 fixes, and this branch is cut from `main` without it. `cargo test --lib themes` (4 tests) and `cargo test --lib backend` (38) pass; `cargo fmt --all --check` and `cargo clippy --all-targets -- -D warnings` are clean. The pr_ready block follows as a comment. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:12:45 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5461
No description provided.