Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jmtd
Copy link
Collaborator

@jmtd jmtd commented Feb 22, 2024

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

  • the new colours here will likely be different to what people experienced prior to this patch
  • it's not impossible for folks to redefine these palette indexes, but it's much less common than redefining the 16 color indexes used prior, as the former are specified as an RGB triplet, and the latter merely as a name e.g. "yellow"

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

  • demo screenshot of artifact bug
  • document rework of dark theme in fixed colors
  • rename "terminal" theme to "inherit"?
  • rename "greenterm" to "greenonblack"
  • close GH issue commands into one or more commit msgs
  • add data about color blind / other visual disability experiences

jmtd added 3 commits March 10, 2024 21:46
Define the default theme in terms of colors from the fixed 240-color
(almost 8-bit) palette. This should ensure consistency between different
terminal applications.

(WIP: describe the reverseVideo trick and caveat here)

(WIP: need to rename moo, at least)

Signed-off-by: Jonathan Dowland <[email protected]>
@jmtd jmtd changed the title WIP: rework default theme with consistent colors WIP: rename default theme to light, rework light+dark themes with consistent colors Mar 10, 2024
@jmtd jmtd force-pushed the hui-default-theme-consistent branch from 52d8d14 to e0f7d41 Compare March 10, 2024 21:57
@simonmichael simonmichael added ui The hledger-ui tool. needs:changes To unblock: needs some changes made, in line with recommendations labels Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:changes To unblock: needs some changes made, in line with recommendations ui The hledger-ui tool.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants