Commit bab07b95f10de5b030dfc8390cb7e59604c330a3

Authored by mj
1 parent 9b408937eb
Exists in master and in 2 other branches 02-merge, dev

spectrum.zsh: ADD working function spectrum_fls

Showing 1 changed file with 8 additions and 0 deletions Inline Diff

repos/robbyrussell/oh-my-zsh/lib/spectrum.zsh
1 #! /bin/zsh 1 #! /bin/zsh
2 # A script to make using 256 colors in zsh less painful. 2 # A script to make using 256 colors in zsh less painful.
3 # P.C. Shyamshankar <sykora@lucentbeing.com> 3 # P.C. Shyamshankar <sykora@lucentbeing.com>
4 # Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ 4 # Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
5 5
6 typeset -Ag FX FG BG 6 typeset -Ag FX FG BG
7 7
8 FX=( 8 FX=(
9 reset "%{%}" 9 reset "%{%}"
10 bold "%{%}" no-bold "%{%}" 10 bold "%{%}" no-bold "%{%}"
11 italic "%{%}" no-italic "%{%}" 11 italic "%{%}" no-italic "%{%}"
12 underline "%{%}" no-underline "%{%}" 12 underline "%{%}" no-underline "%{%}"
13 blink "%{%}" no-blink "%{%}" 13 blink "%{%}" no-blink "%{%}"
14 reverse "%{%}" no-reverse "%{%}" 14 reverse "%{%}" no-reverse "%{%}"
15 ) 15 )
16 16
17 for color in {000..255}; do 17 for color in {000..255}; do
18 FG[$color]="%{[38;5;${color}m%}" 18 FG[$color]="%{[38;5;${color}m%}"
19 BG[$color]="%{[48;5;${color}m%}" 19 BG[$color]="%{[48;5;${color}m%}"
20 done 20 done
21 21
22 22
23 ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} 23 ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
24 24
25 # Show all 256 colors with color number 25 # Show all 256 colors with color number
26 function spectrum_ls() { 26 function spectrum_ls() {
27 for code in {000..255}; do 27 for code in {000..255}; do
28 print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f" 28 print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f"
29 done 29 done
30 } 30 }
31 31
32 # Show all 256 colors (mj fix)
33 function spectrum_fls() {
34 for code in {000..255}; do
35 print -P -- "$FG[$code]$code: $ZSH_SPECTRUM_TEXT %{$reset_color%}"
36 done
37 }
38
39
32 # Show all 256 colors where the background is set to specific color 40 # Show all 256 colors where the background is set to specific color
33 function spectrum_bls() { 41 function spectrum_bls() {
34 for code in {000..255}; do 42 for code in {000..255}; do
35 print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT %{$reset_color%}" 43 print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT %{$reset_color%}"
36 done 44 done
37 } 45 }
38 46