Skip to content

Fix low temperature text visibility on dark terminal backgrounds#225

Merged
kordianbruck merged 2 commits intomasterfrom
copilot/fix-temperature-text-visibility
Apr 11, 2026
Merged

Fix low temperature text visibility on dark terminal backgrounds#225
kordianbruck merged 2 commits intomasterfrom
copilot/fix-temperature-text-visibility

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

Motivation and Context

Cold temperature values (< -3°C) were rendered in deep-blue ANSI 256 colors (21 = #0000ff, 27 = #005fff) that are nearly invisible against dark terminal backgrounds, as shown above.

Description

  • frontends/colors.go (new) — darkBackground() reads COLORFGBG (set by rxvt, xterm, etc.; format "fg;bg" or "fg;default;bg") to detect terminal background. Returns true (dark) when unset, since dark terminals are the dominant use case. Dark = color index 0–6 or 8; light = 7 or 9–15.

  • frontends/ascii-art-table.go and frontends/emoji.go — colmap hoisted outside the color closure so it can be patched before use. On dark backgrounds, the 5 cold-temperature color entries are replaced:

    Temp Before (dark bg) After (dark bg)
    < −15°C 21 #0000ff ☠️ 33 #0087ff
    −15 to −12 27 #005fff ☠️ 39 #00afff
    −12 to −9 33 45 #00d7ff
    −9 to −6 39 51 #00ffff
    −6 to −3 45 51 #00ffff

    Light backgrounds keep the original darker blues. Warm-end colors are untouched.

Steps for Testing

  1. On a dark-background terminal (no COLORFGBG set, or COLORFGBG=15;0): run wego with a location that has sub-zero temperatures — cold temp values should now render in clearly visible cyan-blue.
  2. On a light-background terminal (COLORFGBG=0;15): cold temps should use the original deep-blue palette.
  3. Manually set COLORFGBG=0;15 / COLORFGBG=15;0 to toggle behavior without changing terminal theme.

Screenshots

Before (dark background — cold temperatures barely visible):

before

Copilot AI changed the title [WIP] Fix text visibility for low temperatures in terminal Fix low temperature text visibility on dark terminal backgrounds Apr 11, 2026
Copilot AI requested a review from kordianbruck April 11, 2026 21:20
@kordianbruck kordianbruck marked this pull request as ready for review April 11, 2026 21:40
@kordianbruck kordianbruck merged commit 03a03b5 into master Apr 11, 2026
2 checks passed
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.

Text is not visible at low temperatures.

2 participants