wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
18.15k stars 810 forks source link

Need example of how to override a single 8-color color of a colorscheme #3783

Open unphased opened 1 year ago

unphased commented 1 year ago

This is the relevant doc section: https://wezfurlong.org/wezterm/config/appearance.html#defining-your-own-colors

It does indicate that individual settings in config.colors can override the values provided by a color scheme, which is perfect, however what I'm looking for is specifically to override just one of the ansi list of 8 colors. For example my use case is that the focused terminal background in tmux is #000000 black, and in my colorscheme of choice usually the black color (used by the zsh-autosuggestions) is also #000000 rendering this text impossible to read. It is entirely how to override just one color out of a colorscheme however. As you might imagine i would not really be interested in re-defining the other 7 colors as that is the whole point of specifying a colorscheme in the first place.

wez commented 1 year ago

Take a look at:

Please share what you come up with so that we can find the right spot in the docs for it!

unphased commented 1 year ago

This is perfect.

unphased commented 1 year ago

Is there a way to print/dump e.g. the object returned by e.g. local gruvbox = wezterm.color.get_builtin_schemes()['Gruvbox Light']?

Nevermind, just print does the trick. it will dump it into stdout of whatever term you launch wezterm from.

unphased commented 1 year ago

My solution:

local TMEcolor = wezterm.color.get_builtin_schemes()['Tomorrow Night Eighties'];
TMEcolor.ansi[1] = '#333333'
TMEcolor.brights[1] = '#3d3d3d'

config.color_schemes = {
  ['TME'] = TMEcolor,
}
config.color_scheme = 'TME';

IMO i would add a section in the doc nearby https://wezfurlong.org/wezterm/config/appearance.html#defining-your-own-colors that explains that this is how you customize a few colors out of a predefined colorscheme.