Repository navigation
feat: add the theme engine to Launcher.Core - #63
Merged
Merged
Conversation
Read theme.json into light and dark schemes and apply the readability rules of docs/themes.md: the accent, the button label and edge, and the darkening layer over art are moved by the smallest lightness shift that satisfies every rule. Nothing in a theme can fail a profile; whatever is missing or malformed falls back to its default. The player's own System/Light/Dark choice is kept in config.ini and defaults to the system. Refs #24, #60 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The reference implementation of
docs/themes.mdinLauncher.Core, with no UI yet:ThemeReaderreadstheme.jsoninto aThemeSpecwith a dark and a light scheme. It never throws; an unusable file is the default theme, an unusable field is that field's default, and a missing scheme is built from the other one.ThemeReadabilityresolves a scheme against the launcher's own palette: accent at least 3:1, button label at least 4.5:1 over every fill sample, button edge at least 3:1. A colour keeps its hue and has its lightness moved by the smallest shift that satisfies every rule at once; the result says what was adjusted.ArtDarkeningpicks the darkening layer for text over art (5% steps up to 55%) from the brightest cell of the area the text covers.ColorSchemeSettingis the player's System/Light/Dark choice, stored inconfig.iniasColorScheme; the default is System.Why now
The Avalonia work (#24) and the theme editor (#60) both need one tested implementation of the rules. The editor's JavaScript will be checked against shared vectors generated from this code.
Tests
55 new tests (Launcher.Tests is now 356, Launcher.Avalonia.Tests 10), including sweeps over 216 colours in both palettes, with and without a border, and 300 random gradients.
Refs #24, #60
🤖 Generated with Claude Code