When starting a terminal with powerlevel9k as the theme, the following warning is issued:
WARNING! Your terminal supports less than 256 colors!
You should put: export TERM="xterm-256color" in your ~/.zshrc
Looking into the theme source, I see the following:
# Display a warning if the terminal does not support 256 colors
local term_colors
term_colors=$(tput colors)
if (( term_colors < 256 )); then
print -P "%F{red}WARNING!%f Your terminal supports less than 256 colors!"
print -P "You should put: %F{blue}export TERM=\"xterm-256color\"%f in your \~\/.zshrc"
fi
When running tput colors in the terminal I get 8.
I added export TERM="xterm-256color" to my .zshrc and then tput colors returns 256, but the warning is still issued.
I am running Ubuntu 14.04, and the message occurs in all my terminal emulators.
On another machine, where I am running with d75cdf34d52f02dd49e81f9c693ca4277f92e27e, I do not see the message (as no check is implemented there).
The problem was that I added export TERM="xterm-256color" at the end of my .zshrc file, but this needs to be set BEFORE oh-my-zsh is sourced.
The message displayed could be clearer.
Same here, fixed it with:
~/.zshenv
...
export TERM="xterm-256color"
...
@elezar - Great catch! Would you like to submit a PR to get commit credit?
Sure. I will do so as soon as I get to the office this morning!
Looking into this a bit, and seeing that there are a number of options for installing powerlevel9k, I don't know if simply adjusting the message is enough.
Would it not be better to add more info on the installation section?
I am trying to get the vagrant box running so that I can test the other options.
Is there a reason for not just adding the export to the theme file itself?
@elezar Yep, there are several problems with the warning:
TERM variable must be defined before the theme is calledTERM="xterm-256color" isn't always the right thing. Some people have other terminals and have to set a different value for that. That is also the reason why we can't just set it in the theme itself. Have a look at #30 for further informations.I am afraid, all we can do is to rephrase that warning (maybe with a link to the wiki).
Fixed by 8dfca40.
I just installed powerlevel9k and did a vanilla install on my Arch Linux system. I activate the theme in my zshrc via the following command:
source /usr/share/zsh-theme-powerlevel9k/powerlevel9k.zsh-theme
All was fine until I add the following line above
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Then when I sourced my .zshrc file I started getting the term warning message. I followed the instructions to add the export statement at the top of the zshrc file but it makes no difference. It still gives me the warning. I could go into the theme and rip out that bit of the theme code which generates this warning but I would really like to know why it is happening and why the proposed fix does not work.
I just started getting this warning as well (even with the environment variable the warning suggests set).
I had to use the workaround that 9K suggests, but that did silence the warning (would prefer to fix the issue though).
POWERLEVEL9K_IGNORE_TERM_COLORS=true
@Cypher1 Could you check whether you'll get the same warning with Powerlevel10k?
Ah, sorry I just remembered that I switched from 9k to 10k recently.
Sorry if this is a 10k specific issue.
On Wed., 8 May 2019, 7:34 pm Roman Perepelitsa, notifications@github.com
wrote:
@Cypher1 https://github.com/Cypher1 Could you check whether you'll get
the same warning with Powerlevel10k
https://github.com/romkatv/powerlevel10k/blob/master/README.md#for-powerlevel9k-users
?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/bhilburn/powerlevel9k/issues/135#issuecomment-490418673,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAIRUHRMR52QGM3IR5JDKNDPUKNDLANCNFSM4BUAQGEQ
.
@Cypher1 If you see the warning with the latest version of Powerlevel10k (use git pull to update it), please open an issue against Powerlevel10k: https://github.com/romkatv/powerlevel10k/issues/new. Copy-paste the following commands into your terminal and attach a screenshot of the output.
echo "\$ZSH_VERSION=${(q)ZSH_VERSION}"
echo "\$TERM=${(q)TERM}"
echo "\$(tput colors)=$(tput colors 2>/dev/null)"
echo "\$(echotc Co)=$(echotc Co 2>/dev/null)"
echo "terminfo[colors]=${(q)terminfo[colors]}"
for ((i = 0; i != 256; ++i)); do print -Pn "%F{$i}\u2588%f"; done
Thanks can confirm that it is fixed in the latest. Sorry for the slow reply.
Most helpful comment
Same here, fixed it with:
~/.zshenv