my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.2 KiB

3 years ago
  1. # A script to make using 256 colors in zsh less painful.
  2. # P.C. Shyamshankar <[email protected]>
  3. # Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
  4. typeset -AHg FX FG BG
  5. FX=(
  6. reset "%{%}"
  7. bold "%{%}" no-bold "%{%}"
  8. italic "%{%}" no-italic "%{%}"
  9. underline "%{%}" no-underline "%{%}"
  10. blink "%{%}" no-blink "%{%}"
  11. reverse "%{%}" no-reverse "%{%}"
  12. )
  13. for color in {000..255}; do
  14. FG[$color]="%{[38;5;${color}m%}"
  15. BG[$color]="%{[48;5;${color}m%}"
  16. done
  17. # Show all 256 colors with color number
  18. function spectrum_ls() {
  19. setopt localoptions nopromptsubst
  20. local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
  21. for code in {000..255}; do
  22. print -P -- "$code: ${FG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}"
  23. done
  24. }
  25. # Show all 256 colors where the background is set to specific color
  26. function spectrum_bls() {
  27. setopt localoptions nopromptsubst
  28. local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
  29. for code in {000..255}; do
  30. print -P -- "$code: ${BG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}"
  31. done
  32. }