spectrum.zsh 760 B

1234567891011121314151617181920212223242526272829
  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. typeset -Ag FX FG BG
  6. FX=(
  7. reset "%{%}"
  8. bold "%{%}" no-bold "%{%}"
  9. italic "%{%}" no-italic "%{%}"
  10. underline "%{%}" no-underline "%{%}"
  11. blink "%{%}" no-blink "%{%}"
  12. reverse "%{%}" no-reverse "%{%}"
  13. )
  14. for color in {000..255}; do
  15. FG[$color]="%{[38;5;${color}m%}"
  16. BG[$color]="%{[48;5;${color}m%}"
  17. done
  18. # Show all 256 colors with color number
  19. function spectrum_ls() {
  20. for code in {000..255}; do
  21. print -P -- "$code: %F{$code}Test%f"
  22. done
  23. }