Skip to content

Read theme colors past an inline TOML comment - #34

Open
omarchybot wants to merge 1 commit into
masterfrom
fix/issue-32
Open

Read theme colors past an inline TOML comment#34
omarchybot wants to merge 1 commit into
masterfrom
fix/issue-32

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

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, so foreground = "#EDE6D6" # unbleached cloth reached QML as the literal string "#EDE6D6" # unbleached cloth. QML coerces a color it cannot parse to opaque black, and MarkdownHighlighter builds an equally invalid QColor from the same string, so a theme that annotates its palette — which TOML allows, and which Omarchy's own bin/omarchy-theme-color handles — 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-color does too, so a theme writing background = #1a1b26 still 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 QColor cannot 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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Theme colors with inline TOML comments render as black text (colors.toml parser doesn't strip trailing comments)

1 participant