Closed donm closed 8 years ago
The trouble with using the colors provided by the terminal is that there aren't enough, and they don't look good together :)
Part of the reason bobthefish looks good with its default colors is that they're hand picked to match and compliment each other. Since this is an opinionated theme, it will maintain that, first and foremost. I'm not opposed to letting people override the colors if they so desire, but I haven't found a good way to do that and keep things sane. I'm open to suggestions, though.
I think that the opinionated defaults are good, both in that it is helpful to have them and also that they currently look good. I also think that there are a couple of possible ways to allow the user to customize them.
Currently, bobthefish colors can be changed by overwriting the color variables (__bobthefish_med_red
, etc.) after the theme is loaded. I mean, I don't know if this is intended, but it currently works to just source a file that redefines the colors, after the theme is loaded. So one option would be to have the theme define the 17 color variables only if they have not been set already. That way the user could specify alternate colors in their startup files possibly before loading the theme.
As you say, in the typical 8- or 16-color terminal color schemes there aren't enough colors to match the bobthefish colors (there aren't three different greens, for example). But it would be possible to use 8 or 16 colors to make good looking (or at least readable) prompts if the colors could be specified for each semantic part of the prompt.
I did a quick count and it looked like there were about 15 or so different "states" that parts of the prompt could be in and therefore have a different color; things like "current path is (not) writable" or "git repository is currently clean/staged/stashed". If there were variables for the colors used in each of these states, then the user could customize the foreground and background color of those, which definitely is possible with 8 or 16 colors.
For an example of what I mean, here's an excerpt from the function that creates the colors for the git section:
set -l flag_bg $__bobthefish_lt_green
set -l flag_fg $__bobthefish_dk_green
if [ "$dirty" -o "$staged" ]
set flag_bg $__bobthefish_med_red
set flag_fg fff
else if [ "$stashed" ]
set flag_bg $__bobthefish_lt_orange
set flag_fg $__bobthefish_dk_orange
end
This could be slightly altered to be:
set -l flag_bg $__bobthefish_bg_color_clean_repo
set -l flag_fg $__bobthefish_fg_color_clean_repo
if [ "$dirty" -o "$staged" ]
set flag_bg $__bobthefish_bg_color_dirty_repo
set flag_fg $__bobthefish_fg_color_dirty_repo
else if [ "$stashed" ]
set flag_bg $__bobthefish_bg_color_stashed_repo
set flag_fg $__bobthefish_fg_color_stashed_repo
end
Then at the top of the file, below the color variable definitions, the defaults for the new semantic variables can be set using the default color scheme:
set __bobthefish_bg_color_clean_repo $__bobthefish_lt_green
set __bobthefish_fg_color_clean_repo $__bobthefish_dk_green
set __bobthefish_bg_color_dirty_repo $__bobthefish_med_green
set __bobthefish_fg_color_dirty_repo fff
set __bobthefish_bg_color_stashed_repo $__bobthefish_lt_orange
set __bobthefish_fg_color_stashed_repo $__bobthefish_dk_orange
Except, again, these variables should probably only be set if they are currently not set, so that they can be customized. (I don't know if these names are the best, but you see what I mean.)
This way the user has two choices for customization: specify different shades of green, red, etc. to be used in place of the default colors, which will then be used to set the semantic variables; or specify entirely different colors to be used for each part of the prompt ("a dirty git repo should be black on bright red", etc.). I just hacked something messy together to test it and the same prompt can look really good using the terminal colors with solarized and base16 themes.
So, what do you think? I'm happy to work on this and submit a PR if you'd like, or I'd also be happy to let someone else implement it :)
I've been thinking about this, and I'm not sure allowing easy customization is the right answer.
If bobthefish looks bad with your terminal colors, that's a failing of bobthefish. And bobthefish should be fixing it.
So, in keeping with opinionated defaults, what if bobthefish shipped with opinionated defaults for (say) zenburn, monokai, base16, solarized and tomorrow night, as well as a generic "light" and "dark" palette, and made it easy to pick between those? As a side effect, it would probably be easier to customize for other color schemes as well, but that wouldn't be the primary motivation :)
I think that would be pretty great. In addition to those common themes, I guess I'd also like to have one generic "terminal" theme that could be selected in the same way, where instead of defining a specific color like #FF0000
the color would just be "red" which would fall through and use the value of red in the current terminal color scheme.
Those color choices for that scheme could be made to look readable as long as the terminal theme used something along the lines of base16 or solarized.
:+1: for this. I miss my solarized light!
This would be great. +1 also for @ohspite's idea as it would give some level of automatic colour inheritance.
I was waiting for that whole DCMA takedown nonsense to calm down before working on this. Seems like it has, so I'll try to send you something on this in the next couple of weeks.
Great :)
Great news, I would like to be able to match bobthefish's colours with the bubblegum theme for vim-airline.
Right now the prompt colors are great but only if they match the color scheme currently used by the terminal. If you switch to, say, zenburn...things don't match very well.
One option is for the user to copy the entire theme and replace the hard coded colors with different colors. But what do you think about either adding an option that would use the 16 colors used by the terminal, or adding an option that lets the user override each of the hard coded colors?