Read theme colors past an inline TOML comment - #34
Open
omarchybot wants to merge 1 commit into
Open
Conversation
A `key = value` line was taken whole as the value and unwrapped only when it began and ended with a quote, so `foreground = "#EDE6D6" # unbleached cloth` kept both its quotes and its comment and reached QML as an unparseable string, which draws as opaque black. A theme that documents its palette rendered black text on a black background. A quoted value now ends at its closing quote and whatever trails it is dropped. Unquoted values are still taken verbatim, matching Omarchy's own parser in `bin/omarchy-theme-color`, so a theme writing `background = #1a1b26` keeps working; truncating at the first hash instead would empty every color in every theme, since all of them are quoted hex. Colors that QColor cannot read now leave the built-in default in place, and those defaults are chosen after the theme's mode is resolved rather than before it. Choosing them first would answer a light theme carrying one malformed color by painting the dark default onto a white page. Co-Authored-By: Codex XHigh <noreply@openai.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Backend::loadOmarchyTheme()took everything after the first=as the value and unwrapped it only when it began and ended with a quote. An inline comment leaves the value ending in the comment text rather than a quote, soforeground = "#EDE6D6" # unbleached clothreached QML as the literal string"#EDE6D6" # unbleached cloth. QML coerces a color it cannot parse to opaque black, andMarkdownHighlighterbuilds an equally invalidQColorfrom the same string, so a theme that annotates its palette — which TOML allows, and which Omarchy's ownbin/omarchy-theme-colorhandles — rendered the editor black on black.A quoted value now ends at its closing quote, and whatever trails it is dropped. Unquoted values stay verbatim, which is what
omarchy-theme-colordoes too, so a theme writingbackground = #1a1b26still works. Truncating the value at its first hash instead would empty every color in every shipped theme, since all of them are quoted hex.A color
QColorcannot read now leaves the built-in default in place instead of reaching the window as black, and the defaults are chosen after the theme's mode is resolved rather than before. Resolving them first would answer a light theme carrying one malformed color with the dark default painted onto a white page.Fixes #32