Skip to content

fix(ui): gate 256-index custom themes on terminal depth - #785

Merged
indaco merged 1 commit into
mainfrom
fix/custom-theme-256-color-gate
Jul 26, 2026
Merged

fix(ui): gate 256-index custom themes on terminal depth#785
indaco merged 1 commit into
mainfrom
fix/custom-theme-256-color-gate

Conversation

@indaco

@indaco indaco commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Description

A custom theme built from 256-index colour numbers used to paint on every terminal, including ones that can only render 16 colours - malt's palette ladder went straight from truecolor to 16 with no tier in between, and nothing ever read TERM. On a basic terminal that meant garbled or invisible colours with no way to notice, because the theme reported itself as applied.

malt now recognises a 256-colour tier (COLORTERM first, then a 256color TERM) and gates each custom theme on the depth it actually needs: hex/RGB themes still require truecolor, integer-index themes now require at least 256 colours, and anything a terminal cannot render degrades to the default palette instead of emitting escapes it cannot honour.

This changes existing output. If you use a custom theme with numeric colour values on a terminal that advertises neither truecolor nor 256-colour support, you will now see malt's default palette where you previously saw (incorrectly rendered) theme colours. Setting TERM to a *-256color value restores it on a terminal that genuinely supports 256 colours.

Related Issue

  • None

Notes for Reviewers

  • None

This is part 3 of 3 in a stack made with GitButler:

@indaco
indaco force-pushed the fix/stream-aware-color-enablement branch from f09f49d to a40d27b Compare July 26, 2026 20:59
@indaco
indaco force-pushed the fix/custom-theme-256-color-gate branch from 7d5fff4 to 38b0456 Compare July 26, 2026 20:59
Base automatically changed from fix/stream-aware-color-enablement to main July 26, 2026 21:00
A custom theme built from 256-colour indexes used to paint on every terminal,
including ones that can only render 16 colours, and reported itself as applied
so nobody noticed the garbled output. malt now recognises a 256-colour tier
from COLORTERM then TERM, and degrades any theme the terminal cannot render to
the default palette.
@indaco
indaco force-pushed the fix/custom-theme-256-color-gate branch from 38b0456 to 16552c2 Compare July 26, 2026 21:00
@indaco
indaco merged commit 07d163a into main Jul 26, 2026
3 checks passed
@indaco
indaco deleted the fix/custom-theme-256-color-gate branch July 26, 2026 21:00
indaco added a commit that referenced this pull request Jul 27, 2026
A custom theme built from 256-colour indexes used to paint on every terminal,
including ones that can only render 16 colours, and reported itself as applied
so nobody noticed the garbled output. malt now recognises a 256-colour tier
from COLORTERM then TERM, and degrades any theme the terminal cannot render to
the default palette.

(cherry picked from commit 07d163a)
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.

1 participant