1
0
mirror of https://github.com/akelge/zsh synced 2025-07-03 13:09:07 +00:00
Files
zsh/zsh.d/20-termcolors.zsh
Andrea Mistrali ed9333b79a Extra
re-enable termcolors
add status function
support iterm2 on all platforms
2021-10-28 16:14:03 +02:00

53 lines
1.4 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#######################################################################################
# Colorize terminal
autoload colors zsh/terminfo
zmodload zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
# for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
# eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
# eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
# # (( count = $count + 1 ))
# done
# PR_NO_COLOR="%{$terminfo[sgr0]%}"
# unset color
#
typeset -Ag FX FG BG
FX=(
reset "%{%}"
bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}"
)
for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
done
ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
# Show all 256 colors with color number
function spectrum_ls() {
for code in {000..255}; do
# print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f"
print -P -- "$FG[$code]$code: $ZSH_SPECTRUM_TEXT $FX[reset]"
done
}
# Show all 256 colors where the background is set to specific color
function spectrum_bls() {
for code in {000..255}; do
print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT $FX[reset]"
done
}
# vim: set ts=4 sw=4 tw=0 ft=zsh :