Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.46k stars 949 forks source link

Does this plugin not support extended ANSI colour, for example, "\e[..."? #1368

Open gusbemacbe opened 4 years ago

gusbemacbe commented 4 years ago

Describe Your Issue

Based on one of answers at Unix & Linux Exchange, I rebuilt my favourite colour using RGB, converting to 256 colours' Xterm.

But the OS icon got white instead of greenish goldenrod yellow.

For example:

image

Have you tried to debug or fix it?

I have tried several times, but unsuccessful

Environment Information

Code

terra_magnum_imperium()
{
  echo -n "\e[0;38;2;190;198;25m"
}

typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND="terra_magnum_imperium"
romkatv commented 4 years ago

Judging from your screenshot I'm guessing you are using powerlevel10k. It's a different theme, so in the future please file bug reports and feature requests there.

Zsh supports truecolor naively, so there is no need to use escape codes.

print -P '%F{red}hello%f'
print -P '%F{1}hello%f'
print -P '%F{#ff0000}hello%f'

Converting 190, 198 and 25 to hex, we get #bec619.

POWERLEVEL9K_OS_ICON_FOREGROUND='#bec619'

Note that this doesn't work in the original powerlevel9k but does work in powerlevel10k.

gusbemacbe commented 4 years ago

Note that this doesn't work in the original powerlevel9k but does work in powerlevel10k.

Would you support "e[0;fb8;2;r;g;bm" or just the hexadecimal code in the next version?

I have multiple themes, each theme for each terminal app. On Deepin Terminal and VSCode's integrated terminal, I use P9k, while on Tilix, 910k.

romkatv commented 4 years ago

Would you support "e[0;fb8;2;r;g;bm" or just the hexadecimal code in the next version?

Next version of what?

As I mentioned, #bec619 is the standard zsh way of specifying 24-bit colors. It's not specific to powerlevel10k. It's the recommended way because it's easy to read, it will degrade gracefully on terminals that don't support colors, and it won't cause issues with cursor positioning.

Of course, you can also use escape codes, but it's not something I can recommend. The syntax is this:

typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION=$'%{\e[0;38;2;190;198;25m%}${P9K_CONTENT// }'

I have multiple themes, each theme for each terminal app. On Deepin Terminal and VSCode's integrated terminal, I use P9k, while on Tilix, 910k.

I'm curious, why?

gusbemacbe commented 4 years ago

Next version of what?

To update, adding feature support

The syntax is this:

On P9k?

I'm curious, why?

romkatv commented 4 years ago

Would you support "e[0;fb8;2;r;g;bm" or just the hexadecimal code in the next version?

Next version of what?

To update, adding feature support

Sorry, I don't understand.

The syntax is this:

On P9k?

No, p9k doesn't support this syntax.

I think the only way to do what you want with p9k is to define a custom prompt segment. See https://github.com/Powerlevel9k/powerlevel9k/#custom_command.

I'm curious, why?

  • I depend on several themes I like more. I am not limited.

You know that you can take any p9k config and simply use it with p10k, right?

It works with p10k, too. See https://gist.github.com/romkatv/3e1c685ec83170ecb33267d5c7d3fe3f. Any style that works with p9k also works with p10k.

I'm not saying that you should switch. I just wanted to understand why you use p9k with one terminal and p10k with another.

gusbemacbe commented 4 years ago

Sorry, I don't understand.

To add feature support for these colour arguments.

No, p9k doesn't support this syntax.

Too bad.

I think the only way to do what you want with p9k is to define a custom prompt segment. See Powerlevel9k/powerlevel9k#custom_command.

I tested and it does not work. See the screenshot. I am using P9k.

image

It works with p10k, too. See gist.github.com/romkatv/3e1c685ec83170ecb33267d5c7d3fe3f. Any style that works with p9k also works with p10k. I'm not saying that you should switch. I just wanted to understand why you use p9k with one terminal and p10k with another.

Well, I should have shared the screenshot to you and P10k's responsible, but it was too late, because while I zplugged P9k, using P10k theme or Tony Lambiris's style, I received the p9k....segmented... errors, I do not remember exactly the whole error name. And it broke on VSCode's integrated terminal. I believed because of this screenshot above as I am showing you or because of the some incompatibility. I had to restart a new P10k theme and a new P9k theme for Tony Lambiri's zshrc to get rid of the segments errors.

romkatv commented 4 years ago

I'm having trouble parsing your comments, so I'll withdraw from this issue. If you need help with p10k, please file an issue against p10k. I'll let p9k devs answer your p9k questions.