fix(nvim): keep the palette readable on terminals without truecolor - #54
Merged
Merged
Conversation
termguicolors was forced on, while nightfly defines only gui colours - measured 2026-09-18, its Normal and Comment carry no ctermfg/ctermbg at all. A terminal that cannot parse 38;2;R;G;B therefore had nothing to fall back to and rendered near-black on near-black (#53). Only downgrade on positive evidence of a low-colour terminal, so every host reporting 256 colours keeps nightfly and truecolor unchanged. Closes #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On a terminal that cannot carry truecolor, nvim rendered near-black text on a
near-black background. Such terminals now get
habamaxwithnotermguicolors;terminals reporting 256 colours keep
nightflyand truecolor, unchanged.Closes #53.
Why
Two facts, both measured 2026-09-18 on dev-01:
init.luaforcedopt.termguicolors = trueunconditionally, so nvim emits38;2;R;G;Beven on an 8-colour terminfo. Captured from the raw PTY streamunder
TERM=xterm(tput colors= 8):nightflydefines no cterm colours at all, so nothing readable is leftwhen those sequences do not arrive. Resolved
Normal/Comment, identical onevery TERM tried:
defaultWhat was ruled out first
The tmux config was the other suspect:
.tmux.conf.localsetsdefault-terminal "tmux-256color"and addsTconly for an outerxterm-256color. Probed all 14 fleet hosts through the caged account; 12answered (gapcio and hultaj do not resolve from dev-01, a recorded limit). All
12 have the
tmux-256colorterminfo entry and tmux 3.0a-3.4, so every one isTc-capable. Not the cause on those hosts.Direction of the gate, stated because it is a trade-off
The gate fires only on positive evidence of a low-colour terminal (TERM without
256/directand noCOLORTERM), so no 256-colour host changes. ssh does notforward
COLORTERM, so a capable terminal that advertises nothing lands on thereadable fallback. That direction is deliberate: a downgraded palette is visible
and one line in
~/.config/nvim/local.luaundoes it, while an unreadable bufferis the bug being fixed.
local.lua.exampledocuments the override.Verified
tests/nvim-colour-fallback.sh- new, two arms (low-colour must be readable,256-colour must be unchanged). Wired into
nvim-version-gates, so it runs onpinned nvim 0.10.4 and 0.11.5. No new job, so
ci-gate'sneedsis unchangedand
tests/ci-gate-covers-all.pystill passes.Red-proof. Reverting both halves of the fix (
opt.termguicolors = true,if true then) turns arm 1 red on both checks while arm 2 stays green, so thetest discriminates rather than merely failing:
Restored:
RESULT: PASSED (4 checks ran, none skipped).The skip path is red-proofed too. Arm 2 needs the nightfly plugin on disk;
a failed data-dir probe used to read as "nothing to check". Forcing the probe
to fail now gives
ERROR: could not resolve nvim's data dirand rc=1, and theverdict reports how many checks actually ran.
bash tests/lint-workflows.sh- PASSED (3 checks, none skipped).bash test.sh workstation- 61/62, 0 failures, 1 skip; same as before.shellcheck -S warning clean on the new script.
Not established
Which servers show this, and what their terminals report. If a host where it
looks wrong reports 256 colours, this gate will not fire there and the cause is
something else - the outer-TERM
Tcoverride is the next suspect.TERMandtput colorsfrom one such server would settle it.