|
|
@ -1,20 +1,61 @@ |
|
|
|
# A script to make using 256 colors in ZSH less painful. |
|
|
|
# A script to make using 256 colors in ZSH less painful. |
|
|
|
# P.C. Shyamshankar <sykora@lucentbeing.com> |
|
|
|
# P.C. Shyamshankar <sykora@lucentbeing.com> |
|
|
|
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ |
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com> |
|
|
|
|
|
|
|
|
|
|
|
typeset -Ag FX FG BG |
|
|
|
typeset -Ag FX FG BG |
|
|
|
|
|
|
|
|
|
|
|
FX=( |
|
|
|
FX=( |
|
|
|
reset "%{[00m%}" |
|
|
|
none "\e[00m" |
|
|
|
bold "%{[01m%}" no-bold "%{[22m%}" |
|
|
|
normal "\e[22m" |
|
|
|
italic "%{[03m%}" no-italic "%{[23m%}" |
|
|
|
bold "\e[01m" no-bold "\e[22m" |
|
|
|
underline "%{[04m%}" no-underline "%{[24m%}" |
|
|
|
faint "\e[02m" no-faint "\e[22m" |
|
|
|
blink "%{[05m%}" no-blink "%{[25m%}" |
|
|
|
standout "\e[03m" no-standout "\e[23m" |
|
|
|
reverse "%{[07m%}" no-reverse "%{[27m%}" |
|
|
|
underline "\e[04m" no-underline "\e[24m" |
|
|
|
|
|
|
|
blink "\e[05m" no-blink "\e[25m" |
|
|
|
|
|
|
|
fast-blink "\e[06m" no-fast-blink "\e[25m" |
|
|
|
|
|
|
|
reverse "\e[07m" no-reverse "\e[27m" |
|
|
|
|
|
|
|
conceal "\e[08m" no-conceal "\e[28m" |
|
|
|
|
|
|
|
strikethrough "\e[09m" no-strikethrough "\e[29m" |
|
|
|
|
|
|
|
gothic "\e[20m" no-gothic "\e[22m" |
|
|
|
|
|
|
|
double-underline "\e[21m" no-double-underline "\e[22m" |
|
|
|
|
|
|
|
proportional "\e[26m" no-proportional "\e[50m" |
|
|
|
|
|
|
|
overline "\e[53m" no-overline "\e[55m" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
no-border "\e[54m" |
|
|
|
|
|
|
|
border-rectangle "\e[51m" no-border-rectangle "\e[54m" |
|
|
|
|
|
|
|
border-circle "\e[52m" no-border-circle "\e[54m" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
no-ideogram-marking "\e[65m" |
|
|
|
|
|
|
|
underline-or-right "\e[60m" no-underline-or-right "\e[65m" |
|
|
|
|
|
|
|
double-underline-or-right "\e[61m" no-double-underline-or-right "\e[65m" |
|
|
|
|
|
|
|
overline-or-left "\e[62m" no-overline-or-left "\e[65m" |
|
|
|
|
|
|
|
double-overline-or-left "\e[63m" no-double-overline-or-left "\e[65m" |
|
|
|
|
|
|
|
stress "\e[64m" no-stress "\e[65m" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
font-default "\e[10m" |
|
|
|
|
|
|
|
font-first "\e[11m" no-font-first "\e[10m" |
|
|
|
|
|
|
|
font-second "\e[12m" no-font-second "\e[10m" |
|
|
|
|
|
|
|
font-third "\e[13m" no-font-third "\e[10m" |
|
|
|
|
|
|
|
font-fourth "\e[14m" no-font-fourth "\e[10m" |
|
|
|
|
|
|
|
font-fifth "\e[15m" no-font-fifth "\e[10m" |
|
|
|
|
|
|
|
font-sixth "\e[16m" no-font-sixth "\e[10m" |
|
|
|
|
|
|
|
font-seventh "\e[17m" no-font-seventh "\e[10m" |
|
|
|
|
|
|
|
font-eigth "\e[18m" no-font-eigth "\e[10m" |
|
|
|
|
|
|
|
font-ninth "\e[19m" no-font-ninth "\e[10m" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
for color in {000..255}; do |
|
|
|
FG[none]="$FX[none]" |
|
|
|
FG[$color]="%{[38;5;${color}m%}" |
|
|
|
BG[none]="$FX[none]" |
|
|
|
BG[$color]="%{[48;5;${color}m%}" |
|
|
|
colors=(black red green yellow blue magenta cyan white) |
|
|
|
|
|
|
|
for color in {0..255}; do |
|
|
|
|
|
|
|
if (( $color >= 0 )) && (( $color < $#colors )); then |
|
|
|
|
|
|
|
index=$(( $color + 1 )) |
|
|
|
|
|
|
|
FG[$colors[$index]]="\e[38;5;${color}m" |
|
|
|
|
|
|
|
BG[$colors[$index]]="\e[48;5;${color}m" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FG[$color]="\e[38;5;${color}m" |
|
|
|
|
|
|
|
BG[$color]="\e[48;5;${color}m" |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
unset colors color index |
|
|
|
|
|
|
|
|
|
|
|