simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
2.97k stars 317 forks source link

WIP: rename default theme to light, rework light+dark themes with consistent colors #2175

Open jmtd opened 7 months ago

jmtd commented 7 months ago

This is Work In Progress, it will take me some time to write up properly what's done and why, and what the caveats are -- but I wanted to raise this now before the branch gets too stale.

Rename the default theme to "light" and rework both it and the dark theme in terms of colours picked from the "fixed" 240-color palette. This should result in consistent colours between terminal emulators, with some caveats

A drawback of doing this is that the colours will not display at all in terminals which don't support the 240 palette. I think that it's extremely uncommon for modern users to have a Terminal that doesn't support these; but more common would be having a misconfigured terminal (or some intermediary software: ssh, tmux, screen, etc. introducing a problem). This can be simulated by overriding TERM, e.g. with TERM=xterm-color (where xterm-color is a terminfo definition which doesn't support the 240 color palette).

To make this failure mode less catastrophic, many of the "selected" lines have reverseVideo set, and also the fg/bg colors swapped, which should look like a no-op when the color is supported, but is visible as reversevideo when the color is not supported. This means it can still be used. Example: hledger-256color-nosupport-rv

However, using this reverseVideo hack appears to introduce an unfortunate artifact in the right-hand border of selected lines when color is working: hledger-256color-line-artifact I'm not sure yet whether this is a bug in this patch/hledger-ui, brick or vty. (The dark theme isn't affected)

Some TODOs