Skip to content

Treat empty theme colours as missing when resolving gradients - #19494

Closed
ThePrimeagen wants to merge 3 commits into
omacom:quattrofrom
ThePrimeagen:fix/293b3df4-75da-4534-9288-c31ada37fa89
Closed

ThePrimeagen wants to merge 3 commits into
omacom:quattrofrom
ThePrimeagen:fix/293b3df4-75da-4534-9288-c31ada37fa89

Conversation

@ThePrimeagen

Copy link
Copy Markdown
Contributor

Setting a theme that defines only background and foreground, with no accent, color4 or blue, makes omarchy theme set fail in omarchy-theme-set-templates with THEME_COLORS: bad array subscript, and slack.json is not rendered.

Screenshots

Before After
before after

Reproduce

  1. Press Super+Enter to open a terminal.
  2. Run mkdir -p ~/.config/omarchy/themes/sparse-check && printf 'background = "#101010"\nforeground = "#eeeeee"\n' > ~/.config/omarchy/themes/sparse-check/colors.toml
  3. Run omarchy theme set sparse-check
  4. You see /usr/share/omarchy/bin/omarchy-theme-set-templates: line 61: THEME_COLORS: bad array subscript and slack.json is not rendered.

More cases

Theme explicitly setting accent to an empty string

Before After
before after

resolve_theme_ref and resolve_gradient_color used ${THEME_COLORS[key]+_},
so a present-but-empty entry (created by alias_theme_color for missing
aliases, or set explicitly to "") counted as a hit. That yielded an empty
spec, and resolve_gradient_color then subscripted THEME_COLORS with an
empty REPLY, which bash rejects as a bad array subscript and kills theme
switching mid-render. Test the values for non-emptiness instead, so empty
entries fall back like missing ones, and guard the gradient lookup against
an empty word so it can no longer crash.
@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; no new blocking issues were found.

Summary

This PR treats empty theme colors as missing when resolving gradients and prevents empty color lookups from stopping template rendering.

  • Theme gradients use fallbacks when palette colors are missing or empty.

The earlier request for regression coverage is addressed. No new actionable issues were found.

Reviews (3) · Last reviewed commit: "Update sparse palette test to not requir..." · Reviewed by Greptile

Comment thread bin/omarchy-theme-set-templates Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

Codex High read the diff, surrounding theme-resolution code, callers, and existing template tests. I classified this as a bug fix, but the second classification model, deepseek-v4p1-flash, returned no usable classification, leaving classification unsettled.

CI has passed, and Greptile requests regression coverage for sparse palettes and explicitly empty colors. No worker tests or second-opinion code review ran, so the fix is not verified. This is waiting for classification to be resolved before verification continues.

@omarchybot

Copy link
Copy Markdown
Collaborator

Codex High read the updated diff, surrounding theme-resolution code, callers and regression tests at d67098f. The new tests cover sparse palettes and explicitly empty colors; CI passes, and Greptile scores this head 5/5.

I classified this as a bug fix, but the second classification model, deepseek-v4p1-flash, again returned no usable classification. Classification remains unsettled. No worker tests or second-opinion code review ran, so this review does not verify the fix. Verification is waiting for classification to be resolved.

@omarchybot omarchybot added the bug Something isn't working label Nov 20, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This makes the same change as #19467, which was opened first: the same two edits to resolve_theme_ref and the same empty-name guard in resolve_gradient_color in bin/omarchy-theme-set-templates, with the same two regression tests. The only differences are that #19467 also guards an empty key name in resolve_theme_ref, and how one test line is spelled.

Reviewed by Claude Fable 5.2, comparing the two diffs line by line. Nothing from this branch was run; #19467 is the one being tested on a worker.

Thanks, @ThePrimeagen. Closing this as a duplicate of #19467. It can be reopened if something here is missing there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants