many changes
[zsh.git] / .zsh / functions / spectrum
1 # -*- mode:sh -*-
2
3 # A script to make using 256 colors in zsh less painful.
4 # P.C. Shyamshankar <sykora@lucentbeing.com>
5 # Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
6
7 typeset -Ag FX FG BG
8
9 FX=(
10 reset "%{\e[00m%}"
11 bold "%{\e[01m%}" no-bold "%{\e[22m%}"
12 italic "%{\e[03m%}" no-italic "%{\e[23m%}"
13 underline "%{\e[04m%}" no-underline "%{\e[24m%}"
14 blink "%{\e[05m%}" no-blink "%{\e[25m%}"
15 reverse "%{\e[07m%}" no-reverse "%{\e[27m%}"
16 )
17
18 for color in {000..255}; do
19 FG[$color]="%{\e[38;5;${color}m%}"
20 BG[$color]="%{\e[48;5;${color}m%}"
21 done
22
23 # Show all 256 colors with color number
24 for code in {000..255}; do
25 print -P -- "$code: %F{$code}Test%f"
26 done
27