Open
Description
Idea: instead of assigning to a global parameter (ZSH_HIGHLIGHT_STYLES[myhighlighter:aurora]=fg=green
), set a zstyle; e.g.:
# :<fixed string>:<format number>:<colors>:<highlighter name>:<colorstyle (key)>
zstyle :z-sy-h:0.5:${terminfo[colors]:-unknown}:myhighlighter:aurora color fg=green
Benefits:
- Can easily set the same colorstyle (
aurora
in this example) for multiple highlighters
[anaurora
colorstyle might exist in multiple highlighters; that's why colorstyles are namespaced (0ff354b)] - Can use
zstyle -e
to set colors dynamically (based on $HOSTNAME, date and time, or even retrieved from a cloud service) - Can easily write a theme that works in multiple settings (light/dark terminal background, 88/256/more colors, etc)
The styles would be set by themes or by the user in zshrc, and read in the highlighters as they populate $region_highlight.
As to the themes branch (#241) : perhaps the theme should be part of the context? Then, highlighters could look up color values in the context :z-sy-h:…:${ZSH_HIGHLIGHT_THEME}:…
, and users could change the active a theme simply by assigning to $ZSH_HIGHLIGHT_THEME.
(Terminology note: I'm going to call aurora
a "colorstyle" and the color
a "zstyle"
Activity