Color issues with zsh in wsl
We could examine the $PROMPT
(or $PS1
).
Indeed, oh-my-zsh's agnoster theme uses PROMPT_SUBST
for it. So, we can get the raw escape sequences with redirecting or piping the output of print -P
:
$ print $PROMPT%{%f%b%k%}$(build_prompt)$ print -P $PROMPT | cat -v ;# or redirect to a file as you like^[[39m^[[0m^[[49m^[[40m^[[39m me@mycomputer ^[[44m^[[30mM-nM-^BM-0^[[30m ~ ^[[49m^[[34mM-nM-^BM-0^[[39m
These raw escape sequences; the ANSI escape codes, are well described in https://en.wikipedia.org/wiki/ANSI_escape_code#Colors. It is the CSI codes CSI n m
SGR - Select Graphic Renditoin.
Try to describe the above output:
(^[[39m
: The first two characters are escaped by cat -v
. We've got ESC[39m
.)
^[[39m^[[0m^[[49m
: which are from%{%f%k%b%}
part of theprint $PROMPT
output.^[[39m
to reset default foreground color,^[[0m
reset every effect and[[49m
to reset default background color.^[[40m^[[39m me@mycomputer
: bg black and fg default color^[[44m^[[30m M-nM-^BM-0
: bg blue and fg default color (M-nM-^BM-0
iscat -v
escaped form of )
At this point, it seems that the prompt outputs a bg blue code for pwd. You could check withprint -P '%b%F{red}co%F{green}lo%F{blue}rs%f%b'
(Note: the first '%b')
This means the powershell's color pallet setting does not match with the ANSI escape sequences'. We could check whether the terminal's color pallet setting is correct or not with 16colors.sh
in xterm
distribution if we have sh
with seeing the output of sh ./16colors.sh
.(An example xterm default setting's output could be found for example: https://www.in-ulm.de/~mascheck/various/xterm/16-table.html)
It seems that your powershell's Solarized(?) theme maps the ansi color sequence blue (^[[44m
or ^[[34m
) as grey
-ish color for our eyes.