Closed migmolrod closed 5 years ago
ZHS version: 5.4.2
Does true color actually work on your system? According to http://zsh.sourceforge.net/releases.html, ZSH has true color support only starting from 5.7.
Strange. True color works. This script 24-bit-color.sh prints a nice gradient, both inside Tmux and outside Tmux.
And tests I've done with echo -e
show 24-bit colors as well. Colors are 24-bit, confirmed with the KDE built-in color-picker widget (I mean, they're not approximations to nearest 8-bit colors, which some shells can do, including ZSH).
But according to the link you say, they added the option to use the colors "for prompts and line editor highlighting". Can that be the issue? I can't use true color in prompts but I can everywhere else?
I'll try to upgrade ZSH to 5.7 to try it out, however. But then, what would be the 'syntax' to use 24-bit colors? Something like POWERLEVEL9K_TIME_BACKGROUND='222;111;33'
for example?
@migmolrod That script is testing your terminal's capability. It doesn't use zsh.
I don't think Powerlevel9k currently supports true color. However, it should be fairly easy to add this support. I would expect configuration to be consistent with the way it works with 256 colors, and it would work only with ZSH >= 5.7.
That is, right now you can set:
POWERLEVEL9K_TIME_BACKGROUND=255
Which internally gets translated to %F{255}
.
Once true color support is added to Powerlevel9k, you'll also be able to use this syntax:
POWERLEVEL9K_TIME_BACKGROUND='#ffffff'
This will become (surprise!) %F{#ffffff}
.
P.S.
I'm not a Powerlevel9k contributor, so my opinion is just that -- an opinion.
I understand. I took a look at source code and figured that out. Because its the functions/colors.zsh
file where colorcodes and color names are translated to ZSH-Style colors, right?
Time for me to wait then. I don't have enough time right now to make the needed changes (plus I'm so useless with ZSH scripting, I'd need to learn how to do it, to start with). But in the future maybe I could try to learn, fork and make some tests, I don't know.
Or... I'm actually using Powerlevel10k in this computer. Just in case you want to make a test branch, I can help you and debug easily since with zplugin I can choose what branch to download I think. And who knows, maybe I can learn something taking a look at diff in commits 😅
@migmolrod Sure, I can make these changes in Powerlevel10k. Could you open an issue so that I don't forget? It'll also give me a communication channel to let you know when it's done.
Done. I'll leave here the issue https://github.com/romkatv/powerlevel10k/issues/62 So people interested on it have a quick link from here and can contribute in any of them.
@romkatv not at a physical keyboard right now but it sounds like there are no code changes necessary just docs.
Not sure if there are checks to check for validity though.
What is the expect ion to how it should work?
@Syphdias The current code distinguishes between color codes specified as decimal numbers and names that are looked up in a dict. POWERLEVEL9K_TIME_BACKGROUND='#ffffff'
will use __P9K_COLORS['#ffffff']
as color, which is no color. I think... I haven't actually tried it.
P.S.
My previous comment here incorrectly used ffffff
instead of #ffffff
. I've fixed it.
I can confirm POWERLEVEL9K_TIME_BACKGROUND='#ffffff'
don't work. Neither does ='ffffff'
without the sharp.
For anyone interested, with latest commit in https://github.com/romkatv/powerlevel10k/tree/master, it works perfectly, confirmed. I think it would be quite great to have it here in P9K as well. I've taken a look at @romkatv commit and it seems to me like a relatively minor change for such a great feature: https://github.com/romkatv/powerlevel10k/commit/182f0f71627a2f8b84b80ae5c320b061c987ed22
What do you think about it, contributors/mantainers?
I'll close this. Solved by #1262
Issue/Question
I'm trying to use 24-bit colors ('true color') as my segment backgrounds/foregrounds but according to the documentation here https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#segment-color-customization it seems only 8-bit colorcodes are accepted. Is there any way this would work out-of-the-box or is this more like a feature request?
Environment Information
This information will help us understand your configuration.