-
-
Notifications
You must be signed in to change notification settings - Fork 326
WIP: rename default theme to light, rework light+dark themes with consistent colors #2175
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
base: master
Are you sure you want to change the base?
Conversation
52d8d14
to
e0f7d41
Compare
Hi @jmtd, do you have time to revisit this hledger-ui PR: rename default theme to light, etc.. ? |
Yeah I can pick it up. Are you particularly interested in the theme renaming, or the consistent colours, or both? For the latter, at least with the approach used in the PR as it stands, do you think the visual artifact (second pic in original comment) is a blocker? If so I need to look at VTE I think and see if it's a bug at that level. |
As it happens I have used hledger-ui very little in recent months. Right now I'm mainly interested in resolving open PRs. Generally, I'm interested in
I don't think the miscoloured margin character need be a blocker. |
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. If a terminal does not support the 240-color palette (very unlikely these days. Simulate with TERM=xterm-color) the UI is unusable. To mitigate this, selections are also marked as "reverse video", which will ensure they are differentiated even with colours disabled. Signed-off-by: Jonathan Dowland <jon@dow.land>
Signed-off-by: Jonathan Dowland <jon@dow.land>
Fixes: simonmichael#2168. Signed-off-by: Jonathan Dowland <jon@dow.land>
e0f7d41
to
c2dd3b7
Compare
I've rebased, cleaned up and tested the branch. |
Thanks @jmtd. Some testing notes: Use of the 240-color palette to improve consistency between terminals - this is working. With TERM=xterm, implying 8 color support, hledger-ui has always showed the usual colors: ![]() Now it shows almost monochrome. Shouldn't it show the 8 color approximation as before ? ![]() Also the header and footer lines now have a white bg, I guess because their intended reverse video is being reversed. I noticed some other TERM cases we should probably handle more gracefully, but they aren't caused by this PR:
|
Let's keep supporting --theme=default as a (undocumented) alias for --theme=light, to avoid breakage. You suggested renaming greenterm to greenonblack - I'd be ok with it (with a compatibility alias). I'd also be ok with renaming terminal. I have a hard time finding a name that communicates intuitively what it will look like. I guess "inherit" is another reasonable choice, though will be a little unclear to some. Looking at the code, it just sets the borders to white on black, and sets the selected item to reverse video. I'm not sure how useful that is. The goal was a theme that disturbs your usual terminal colours as little as possible. Perhaps your monochrome-with-reverse-video mode should be used here. Would "mono" or "monochrome" also be reasonable names ? |
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. withTERM=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:However, using this reverseVideo hack appears to introduce an unfortunate artifact in the right-hand border of selected lines when color is working:

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