-
Notifications
You must be signed in to change notification settings - Fork 424
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
feature request: toggle night/day mode theme #592
Comments
This is an interesting request. I see two parts:
The first part totally makes sense, and I was planning on it for v2.0 anyway, but this is a good issue to log that. The second part might be tricky, and I'm not sure that the prompt is the right place to set that. I'm not sure that the terminal is the right place either, so I'll keep this as a feature request and dig to it more. |
v2.0.0-beta.1 has the capability to switch between themes at runtime. See Switching Themes. Thanks for the suggestion! As for
I do not think this is something Liquidprompt can or even should try to do. It can only control what it prints to the terminal, any other program that you run will not know that you want your "default" color to be something else, and will still use the real default color. This is something that should be managed in your terminal emulator. |
@Rycieos do you mind extending documentation, or at least mentioning here, how to address request in question? a night/day mode. I think that can attract users to this new feature. |
Normally, I'm all for extending documentation. But since I would never recommend doing this, I don't think I'll add this specific solution to the docs. I will be soon adding an example that shows how to make a "lightweight" theme, which this is closely following: My solution "hacks" the default theme, so I don't have to re-implement everything. But this makes for some issues:
So again, I don't recommend this. You could probably fix this up a bit, but the second point will be hard to fix. Better to use a terminal emulator that lets you change colors, and swap themes there. My terminal can do it (Mintty). But if you want to try anyway, here is the code I came up with for this: _lp_default_inverted_theme_activate() {
local lp_terminal_format
LP_COLORMAP=("")
# Black on white
lp_terminal_format 232 255 0 0 0 7
NO_COL=$lp_terminal_format
# Green on white
lp_terminal_format 28 -2 0 0 2
LP_COLORMAP+=("$lp_terminal_format")
LP_COLOR_X11_ON=$lp_terminal_format
LP_COLOR_WRITE=$lp_terminal_format
LP_COLOR_UP=$lp_terminal_format
LP_COLOR_CHARGING_ABOVE=$lp_terminal_format
# Bold green on white
lp_terminal_format -2 -2 1 0
LP_COLORMAP+=("$lp_terminal_format")
# Yellow on white
lp_terminal_format 40 -2 0 0 3
LP_COLORMAP+=("$lp_terminal_format")
LP_COLOR_JOB_D=$lp_terminal_format
LP_COLOR_JOB_D=$lp_terminal_format
LP_COLOR_X11_OFF=$lp_terminal_format
LP_COLOR_COMMITS=$lp_terminal_format
LP_COLOR_CHARGING_UNDER=$lp_terminal_format
LP_COLOR_DISCHARGING_ABOVE=$lp_terminal_format
LP_COLOR_RUNTIME=$lp_terminal_format
# Bold yellow on white
lp_terminal_format -2 -2 1 0
LP_COLORMAP+=("$lp_terminal_format")
LP_COLOR_PATH_ROOT=$lp_terminal_format
LP_COLOR_JOB_R=$lp_terminal_format
LP_COLOR_JOB_Z=$lp_terminal_format
LP_COLOR_USER_ROOT=$lp_terminal_format
LP_COLOR_SU=$lp_terminal_format
# Blue on white
lp_terminal_format 18 -2 0 0 4
LP_COLOR_SSH=$lp_terminal_format
LP_COLOR_TIME=$lp_terminal_format
# Bold blue on white
lp_terminal_format -2 -2 1 0
LP_COLOR_PROXY=$lp_terminal_format
LP_COLOR_IN_MULTIPLEXER=$lp_terminal_format
# Magenta on white
lp_terminal_format 24 -2 0 0 5
LP_COLOR_ERR=$lp_terminal_format
LP_COLOR_DIFF=$lp_terminal_format
# Cyan on white
lp_terminal_format 30 -2 0 0 6
LP_COLOR_VIRTUALENV=$lp_terminal_format
# Red on white
lp_terminal_format 52 -2 0 0 1
LP_COLORMAP+=("$lp_terminal_format")
LP_COLOR_NOWRITE=$lp_terminal_format
LP_COLOR_CHANGES=$lp_terminal_format
LP_COLOR_DISCHARGING_UNDER=$lp_terminal_format
# Bold red on white
lp_terminal_format -2 -2 1 0
LP_COLORMAP+=("$lp_terminal_format")
LP_COLOR_MARK_ROOT=$lp_terminal_format
LP_COLOR_MARK_SUDO=$LP_COLOR_MARK_ROOT
LP_COLOR_COMMITS_BEHIND=$lp_terminal_format
# Bold black on red
lp_terminal_format 232 -3 1 0 0
LP_COLORMAP+=("$lp_terminal_format")
# Bold white on red
lp_terminal_format 255 -2 1 0 7
LP_COLORMAP+=("$lp_terminal_format")
# Bold yellow on red
lp_terminal_format 40 -2 1 0 3
LP_COLORMAP+=("$lp_terminal_format")
_lp_default_theme_activate
}
_lp_default_inverted_theme_directory() {
_lp_default_theme_directory
}
_lp_default_inverted_theme_prompt() {
_lp_default_theme_prompt
} There is probably also a simpler solution involving setting the color variables to one of two settings in your config file if you have a flag enabled or something, but again, I don't think this is a good idea. |
Thanks to discussion on #657, the default theme since v2.0.1 now "supports" running in both light and dark mode. The trick is that Liquidprompt can and does not control that; it is still up to the terminal emulator. But now you only need to set the default foreground and background colors, and Liquidprompt should still display correctly. See the screenshots in this #657 (comment) If you still want to do that on the fly with a toggle button, I'm afraid that is still outside the scope of Liquidprompt, and is something your terminal emulator will need to support. |
Shell: bash
Operating system: Xubuntu 18.04
Liquid Prompt version (tag, commit): official apt repo
Working with themes seems to be quite complicated at the moment. Not just in liquidprompt but also in plain terminal apps, e.g. Change color scheme for xfce4 terminal manually.
I would like to request a very single theme switch option for night/day theme modes.
Basically "night mode" could be (AFAIK) as the current default one (black background), and the "day mode" could a white background theme.
Why the request?
During the day it is sometimes difficult to read console output like
git status
where unstaged files are listed in dark red color. Switching to a "day mode" would basically resolve problems like this. That would be a big advantage for liquidprompt over a plain bash, where you cannot easily swap colors (as explained in linked askubuntu).Thanks for the great software!
The text was updated successfully, but these errors were encountered: