From 0c943ac6d5beebc381b3e49858a5ef6861289d29 Mon Sep 17 00:00:00 2001 From: Charles Peterson Date: Sun, 31 Dec 2017 14:34:01 -0600 Subject: colors checking optimized and added tput for check the colors moved to colors functions, because it makes sense. --- functions/colors.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'functions') diff --git a/functions/colors.zsh b/functions/colors.zsh index 3a7da27f..253de7cb 100644 --- a/functions/colors.zsh +++ b/functions/colors.zsh @@ -6,6 +6,22 @@ # https://github.com/bhilburn/powerlevel9k ################################################################ +function termColors() { + local term_colors + + if which tput &>/dev/null; then + term_colors=$(tput colors) + else + term_colors=$(echotc Co) + fi + if (( ! $? && ${term_colors:-0} < 256 )); then + print -P "%F{red}WARNING!%f Your terminal appears to support fewer than 256 colors!" + print -P "If your terminal supports 256 colors, please export the appropriate environment variable" + print -P "_before_ loading this theme in your \~\/.zshrc. In most terminal emulators, putting" + print -P "%F{blue}export TERM=\"xterm-256color\"%f at the top of your \~\/.zshrc is sufficient." + fi +} + # get the proper color code if it does not exist as a name. function getColor() { # no need to check numerical values -- cgit v1.2.3