romkatv / powerlevel10k

A Zsh theme
MIT License
46.59k stars 2.19k forks source link

Color not properly reseted when using TrueColor #1302

Closed alteriks closed 3 years ago

alteriks commented 3 years ago

I've been trying to change some colors in p10k.zsh file to help me differentiate between multiple hosts at first glance. Unfortunately changing os icon to TrueColor POWERLEVEL9K_OS_ICON_BACKGROUND='#FFCE00' before directory segment gives me black background in some parts of this segment 2021-03-15_12-20 2021-03-15_12-21 This problem can be alleviated by using TrueColor in all segments that come after first usage of web color format ie POWERLEVEL9K_DIR_BACKGROUND=#2278B2 2021-03-15_12-22

Is this a bug or does it work that way by design? If it is the latter I haven't found any mention about this behaviour in documentation.

romkatv commented 3 years ago

Please attach a complete config that demonstrates the issue.

alteriks commented 3 years ago

p10k.zsh is located in my dotfiles repo. Master branch is working using workaround - using TrueColor whenever neccesary. Branch truecolor_problem has default POWERLEVEL9K_DIR_BACKGROUND=4 which gives black background around bolded parts of dir segment https://github.com/alteriks/dotfiles/commit/98f11406184e5e2b2d6e2014d41d51629c87a4b7

romkatv commented 3 years ago

p10k.zsh is located in my dotfiles repo.

Please either attach the complete config that demonstrates the issue or post a link to it.

alteriks commented 3 years ago

https://github.com/alteriks/dotfiles/blob/98f11406184e5e2b2d6e2014d41d51629c87a4b7/.config/zsh/.p10k.zsh I've narrowed down issue to POWERLEVEL9K_DIR_ANCHOR_BOLD=true. With bold disabled one can mix colors from standard palette and truecolor.

romkatv commented 3 years ago

Thanks.

This is caused by a bug in zsh. To reproduce:

zsh -fc 'print -P "%F{#ff0000}red%F{green}%B bold green"'
romkatv commented 3 years ago

If this bothers you, consider sending a patch to zsh-workers.