launcher: an accent colour and a picture behind Home

Settings > Launcher picks an accent (violet by default, blue, teal, green, amber, red, pink)
and the player's own picture behind Home. An accent turns the violet tokens to its hue and
adjusts their lightness until text on the Play button and the accent on every background read
as well as the violet's. The picture is checked, copied under a name of its hash and shown
cropped under the banner's veils. CLI: settings accent NAME, settings background PATH|default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-27 05:07:38 +01:00
parent b3709b9766
commit 8beaa57331
12 changed files with 577 additions and 31 deletions
+24 -2
View File
@@ -604,7 +604,9 @@ enum Cmd {
/// minecraft-dir PATH, server-dir PATH ("default" resets a folder), install-new-versions
/// on|off, opening-animation on|off, proxy http://host:port ("default" removes it),
/// while-playing stay|minimize|hide (what the window does while the game runs), language
/// system|en|fr|ru (the window's language; system follows the computer's)
/// system|en|fr|ru (the window's language; system follows the computer's), accent
/// violet|blue|teal|green|amber|red|pink, background PATH (a picture behind Home; "default"
/// shows Horizon's landscape)
Settings {
#[arg(value_parser = SETTING_KEYS)]
key: Option<String>,
@@ -741,7 +743,7 @@ pub fn command() -> clap::Command {
pub const AI_COMMANDS: [&str; 2] = ["mcp", "agent-config"];
/// The keys `settings` sets.
const SETTING_KEYS: [&str; 8] = [
const SETTING_KEYS: [&str; 10] = [
"selected-version",
"minecraft-dir",
"server-dir",
@@ -750,6 +752,8 @@ const SETTING_KEYS: [&str; 8] = [
"proxy",
"while-playing",
"language",
"accent",
"background",
];
fn on_off(value: &str) -> Result<bool, String> {
@@ -772,6 +776,22 @@ fn set_setting(s: &mut backend::Settings, key: &str, value: &str) -> Result<(),
s.while_playing = backend::WhilePlaying::parse(value)
.ok_or_else(|| format!("{value}: say stay, minimize or hide"))?
}
"accent" => {
use horizon_launcher::themes::Accent;
s.accent = Accent::parse(value).ok_or_else(|| {
let names: Vec<_> = Accent::ALL.iter().map(|a| a.name()).collect();
format!("{value}: say {}", names.join(", "))
})?
}
"background" => {
s.background = match value.trim() {
"default" | "" => None,
file => Some(horizon_launcher::themes::keep_background(
&backend::data_dir(),
std::path::Path::new(file),
)?),
}
}
"language" => {
use horizon_launcher::i18n::Language;
s.language = match value.trim() {
@@ -809,6 +829,8 @@ fn settings_json(s: &backend::Settings) -> serde_json::Value {
"desktop_entry": s.desktop_entry.unwrap_or(true),
"while_playing": s.while_playing.name(),
"language": s.language.map_or("system", |l| l.code()),
"accent": s.accent.name(),
"background": horizon_launcher::themes::background(&backend::data_dir(), s.background.as_deref()),
"no_ai": backend::no_ai(),
})
}