Skip to content

Use the fallback colour when a theme colour is empty - #19445

Closed
ThePrimeagen wants to merge 4 commits into
omacom:quattrofrom
ThePrimeagen:fix/562bccd5-0dd8-4f5a-a3ee-f7315b5d8f49
Closed

ThePrimeagen wants to merge 4 commits into
omacom:quattrofrom
ThePrimeagen:fix/562bccd5-0dd8-4f5a-a3ee-f7315b5d8f49

Conversation

@ThePrimeagen

Copy link
Copy Markdown
Contributor

Switching to a theme whose colors.toml has only background and foreground makes the switch fail: omarchy-theme-set-templates prints THEME_COLORS: bad array subscript and templates, including Slack's, do not render.

Screenshots

Before After
before after

Reproduce

  1. Press Super+Return to open a terminal.
  2. Create a sparse theme with only two colours: mkdir -p ~/.config/omarchy/themes/sparse-test && printf 'background = "#111111"\nforeground = "#eeeeee"\n' > ~/.config/omarchy/themes/sparse-test/colors.toml
  3. Switch to it with omarchy theme set sparse-test
  4. See omarchy-theme-set-templates: line 61: THEME_COLORS: bad array subscript and the switch does not complete.

More cases

User template using gradient_start on missing colours

Before After
before after

Treat present-but-empty theme colors as unresolved instead of
resolving them. resolve_theme_ref now checks for a non-empty value
before using a key or its fallback, resolve_gradient_color returns
early on an empty value so it never evaluates an empty array
subscript, and alias_theme_color only assigns when the fallback
color is non-empty so sparse themes no longer gain empty aliases
such as accent, red or blue.
@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge.

Summary

Empty theme colors now use the fallback instead of stopping at an empty value.

  • Theme templates keep rendering when palette colors are missing.

No new actionable issues found. The earlier request for empty-color test coverage is addressed.

Reviews (4) · Last reviewed commit: "Merge origin/quattro and resolve conflic..." · Reviewed by Greptile

Comment thread bin/omarchy-theme-set-templates Resolved
@greptile-apps

This comment has been minimized.

@omarchybot

Copy link
Copy Markdown
Collaborator

Codex High read both changed commands, their callers, the existing template tests, and Greptile's comments at c198078. My classification is bug, but the configured second classifier, deepseek-v4p1-flash, returned no classification, so classification remains unsettled. No worker tests or full second-opinion review ran, and no changes were pushed. Greptile's request for an empty-value regression test remains unaddressed. This is waiting for the maintainer to resolve classification before verification continues.

@omarchybot

Copy link
Copy Markdown
Collaborator

Codex High read revision 837c54d43ab2f844c1e6039e1ee249a6e866fba4, both changed commands and their callers, the template tests, and Greptile’s findings. This revision adds regression coverage for sparse palettes and explicitly empty colors, addressing the missing coverage noted in my earlier comment; those tests have not been run on a worker by this review.

My classification remains bug, but the configured second classifier, deepseek-v4p1-flash, again returned no classification. Classification remains unsettled, so worker verification and a full second-opinion review have not proceeded. No changes were pushed or labels added. This is waiting for the maintainer to resolve classification before verification continues.

@omarchybot

Copy link
Copy Markdown
Collaborator

Codex High read revision d80beca130d7eaa355f637124b6c50b67bf59111, both changed commands and their consumers, the template tests, and the discussion. The revised sparse-palette test now checks the built-in templates dynamically and adds a user template whose gradient_start references are missing. These checks have not been run on a worker by this review.

My classification remains bug, but the configured second classifier, deepseek-v4p1-flash, returned no classification for this head. The queue workflow requires classification to settle before verification, so no worker tests or full second-opinion review ran, and no changes were pushed or labels added. This is waiting for the maintainer to resolve classification.

@omarchybot

Copy link
Copy Markdown
Collaborator

Codex High reproduced the sparse-palette error on quattro and confirmed that d80beca130d7eaa355f637124b6c50b67bf59111 renders the templates without it. An explicitly empty border color also uses its blue fallback. Reverting only this PR's command changes restores the error, and the added regression test fails on that reverted tree.

The CLI suite and the template, user-theme, tmux, Slack, Herdr, VS Code and theme-switch-budget tests passed on a disposable ISO worker. Slack's test needed Node.js installed on that worker. No changes were pushed. Greptile's requested empty-value coverage is present in the contributor's tests and passed.

Codex High found no actionable defect. The configured Opus 5.5 High second-opinion run ended without a report; a later health check answered but did not review this PR. Verification evidence is recorded, while the review remains incomplete and is waiting on the maintainer. The verified and ready labels have been withheld.

The captures show the worker terminal's recorded command and template results; they do not establish how sparse themes look inside applications.

Before: sparse and empty-color rendering fails with bad array subscript

After: both rendering checks pass on the PR head

@omarchybot

Copy link
Copy Markdown
Collaborator

A follow-up on one part of this change that the earlier review did not look at: the alias_theme_color hunk at bin/omarchy-theme-color:117, at d80beca.

  • The fix does not need it. With this branch merged into quattro at b20d787 and only that hunk put back to the base version, test/shell.d/theme-templates-test.sh still passes 21 of 21 on a worker, so no test here covers it. The error and the empty border are fixed by the three lines in bin/omarchy-theme-set-templates.
  • It changes what a two-colour theme renders. alias_theme_color no longer creates a key when its fallback is empty too, so those keys drop out of omarchy-theme-color --all and their {{ red }}, {{ accent }} and similar tokens are left in the output unreplaced. Rendering a colors.toml with only background and foreground on a worker left raw placeholders in 5 of 24 generated files on quattro at b20d787, and in 21 of 24 with this branch merged into it; this head on its own base gives the same 21.
  • One consequence was read from the source and not run: gum_env.lua then holds hl.env("BORDER_FOREGROUND", "{{ accent }}"), and omarchy-theme-set-tmux exports any non-empty value from that file to tmux sessions, where it skipped the "" that quattro writes.
  • The stock themes and an ANSI-only palette (color0 to color7) render the same with and without the hunk, since no key resolves empty for them.

#19467 makes the same change to bin/omarchy-theme-set-templates without this hunk, and is the one being carried forward.

Reviewed by Claude Fable 5.2, which ran the renders and the reverted-hunk test. Opus 5.5 High and muse-wonder (thinking high) read both diffs as a second opinion and each called the hunk a defect; the tmux consequence is Opus's finding, and I checked the pattern it names in omarchy-theme-set-tmux by reading. Their independence is not guaranteed.

Nothing was pushed. Which of the two lands is the maintainer's choice.

@omarchybot

Copy link
Copy Markdown
Collaborator

Codex High re-read f86b43dce1b4feb1fd480fd4eff66d8134714dd6, the changed commands, their consumers and tests, and compared #19467 and #19474. The merge from quattro leaves the earlier alias concern unchanged: alias_theme_color omits missing aliases from --all, while the renderer only substitutes keys that it receives. With only background and foreground, this leaves tokens such as {{ accent }} in gum_env.lua; the tmux environment reader accepts that non-empty text where it previously skipped an empty value.

Opus 5.5 High favors #19467 because it fixes empty-value fallback handling without this alias change. muse-wonder via pi, thinking high, acknowledged the placeholder consequence but gave differing recommendations, treating alias omission as an improvement in its three-way comparison. I retain the regression finding after checking the cited code paths; reviewer independence is not guaranteed. #19474 carries the same alias change and adds fallback-chain behavior.

No worker tests ran for this head: this comparison stops before verification because I favor the competing #19467. Its own worker verification is still required. Nothing was pushed, and this PR remains open, without verified or ready, for the maintainer's choice between the fixes.

omarchybot added a commit to ThePrimeagen/omarchy that referenced this pull request Nov 25, 2026
The existing empty-colour fixture always resolves through a non-empty blue or a literal fallback. Carry the sparse fallback scenario from omacom#19445 into the focused regression: a missing primary colour and an empty accent alias retain the fallback name without a subscript diagnostic. Reverting only the fallback non-empty check makes this assertion fail; the existing assertions still pass. This preserves the documented single-fallback grammar without claiming a sparse palette produces usable application colours.

Co-Authored-By: ThePrimeagen <the.primeagen@gmail.com>
Co-Authored-By: muse-wonder via pi, thinking high <noreply@openai.com>
Co-Authored-By: GPT-6 (reasoning effort not exposed) <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants