Skip to content

Keep the transparent bar's text legible on a bright wallpaper - #15929

Open
anandude wants to merge 1 commit into
omacom:quattrofrom
anandude:fix/bar-text-color-contrast-floor
Open

anandude wants to merge 1 commit into
omacom:quattrofrom
anandude:fix/bar-text-color-contrast-floor

Conversation

@anandude

Copy link
Copy Markdown
Contributor

Fixes #14732

Problem

With a transparent bar, bin/omarchy-bar-text-color samples the wallpaper strip under the bar and prints whichever of the theme text color and the theme background color has the higher contrast against that average. There is no floor.

Both candidates are surface colors a theme picked for a solid bar, so on a bright wallpaper the better of them can still be under the 4.5:1 WCAG AA floor for small text. On Liftoff's blue sky (#3f87b8) the helper returns #151E26 at 4.31:1 while the cream foreground is 3.12:1 — and the charcoal is close enough in hue to the sky that the shortfall reads as a soft edge. Against the sky directly behind the clock (#1d73ac) it is 3.29:1.

$ omarchy-bar-text-color top 26 '#ECE5D8' '#151E26'    # before
#151E26

Change

When neither theme color clears 4.5:1 against the sample, print the plain ink that is legible there instead — black or white, whichever has the higher contrast. The two theme colors still compete exactly as before whenever either of them clears the floor, so this only changes the outcome on wallpapers where both fail:

$ omarchy-bar-text-color top 26 '#ECE5D8' '#151E26'    # after
#000000
Behind the glyphs Wallpaper #151E26 #ECE5D8 #000000
Open blue, left side #097bba 3.66:1 3.68:1 4.55:1
Clock sky #1d73ac 3.29:1 4.09:1 4.10:1
Pale cloud, right side #7ba4c2 6.37:1 2.11:1 7.93:1

One global color still cannot clear 4.5:1 on a backdrop that runs from a saturated sky to a pale cloud: the clock sky tops out at 4.10:1 for any single ink. Per-region ink, as #8615 proposes, is the follow-up that would clear it; this change takes the floor as far as a single bar-wide color can.

There is no layout or styling change — the helper's output contract (one color) and Bar.qml are untouched.

Tests

test/shell.d/bar-text-color-test.sh gains two cases: a saturated mid-blue strip where both theme colors miss the floor and the fallback is black (5.37:1 over 4.31:1), and a mid-grey strip where the fallback is white (5.33:1 over 4.25:1).

ok - transparent bar text switches to background color on light wallpaper
ok - transparent bar text keeps text color on dark wallpaper
ok - transparent bar text falls back to black ink when both theme colors miss the contrast floor
ok - transparent bar text falls back to white ink on a mid-tone wallpaper
ok - transparent bar text falls back to text color when sampling fails
ok - transparent bar text samples one frame of a video wallpaper

The shell suite's other failures on this machine reproduce on clean quattro in a live session (the ones I checked — background-instant-reload-test, default-apps-test, i18n-test, battery-status-test — fail with these changes stashed), so they are the environment, not this change. ./test/cli passes (125 checks).

bin/omarchy-bar-text-color is also touched by #14281 and #14220, both in the sampling block above the color choice, so the second of those to land needs a trivial rebase here.

The helper printed whichever of the theme text and theme background had the
higher contrast against the bar strip's average, with no floor. A dark theme's
background is a charcoal surface rather than ink, so the theme colors can both
fall under the 4.5:1 WCAG AA floor for small text. On Liftoff's blue sky
(#3f87b8) the bar came out #151E26 at 4.31:1, close enough in hue to the sky
that it reads as a soft edge, while the cream foreground was 3.12:1.

When neither theme color clears the floor, use the plain ink that is legible on
the sample instead.
@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Adds a contrast floor to omarchy-bar-text-color.

  • The transparent bar uses black or white when both theme colors lack contrast.

anandude explicitly acknowledges that one bar-wide color cannot guarantee contrast across every wallpaper region and defers per-region colors.

No actionable issues found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "Keep the transparent bar's text legible ..." · Reviewed by Greptile

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed far enough to classify, and the classification is unsettled, so nothing has been tested yet and no labels have gone on.

Two models classified this pull request separately. Claude Opus 5.5 called it a bug fix: on a shipped theme and wallpaper (Liftoff's #151E26 / #ECE5D8 over 01-liftoff.png), the transparent bar's text falls under the 4.5:1 floor, as #14732 reports. Codex Medium called it an enhancement: the helper is doing what it was written to do, picking the better of the two theme colours, and this changes that on purpose by adding a contrast floor and a black or white fallback that sits outside the theme's palette. Both readings hold up, and which one applies decides how it gets worked: a bug fix is reproduced and verified on a worker, and a feature waits until the maintainer asks for it.

Not a duplicate: #8615 goes after the same issue with per-region colours and is a broader change, and #14281 and #14220 only touch the sampling above the colour choice.

Next step is the maintainer's: they decide whether a black or white fallback is behaviour they want in the transparent bar, and that settles the classification. Until then, nothing else happens on this pull request.

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.

Transparent bar text falls below 4.5:1 when both theme colors lose to the wallpaper

2 participants