Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

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

Open
gusbemacbe opened this issue Oct 1, 2019 · 7 comments

Comments

@gusbemacbe
Copy link

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

  • What version of ZSH are you using? You can use zsh --version to see this.
    zsh 5.7.1 (x86_64-pc-linux-gnu)
  • Do you use a ZSH framework (e.g., Oh-My-ZSH, Antigen)?
    Yes, I use zplug
  • How did you install P9k (cloning the repo, by tarball, a package from your OS, etc.,)?
    I installed it via zplug
  • What version of P9k are you using?
    The latest version of P9, but actually I use P10 instead
  • Which terminal emulator do you use?
    Deepin Terminal and Tilix

Code

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

typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND="terra_magnum_imperium"
@romkatv
Copy link

romkatv commented Oct 1, 2019

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
Copy link
Author

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
Copy link

romkatv commented Oct 1, 2019

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
Copy link
Author

gusbemacbe commented Oct 1, 2019

Next version of what?

To update, adding feature support

The syntax is this:

On P9k?

I'm curious, why?

@romkatv
Copy link

romkatv commented Oct 1, 2019

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
Copy link
Author

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
Copy link

romkatv commented Oct 1, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants