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