Advertisement
mr_dot_convict

Bash-colors-mr.convict

May 1st, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.28 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # This program is free software. It comes without any warranty, to
  4. # the extent permitted by applicable law. You can redistribute it
  5. # and/or modify it under the terms of the Do What The Fuck You Want
  6. # To Public License, Version 2, as published by Sam Hocevar. See
  7. # http://sam.zoy.org/wtfpl/COPYING for more details.
  8.  
  9. for fgbg in 38 48 ; do # Foreground / Background
  10.    for color in {0..255} ; do # Colors
  11.       # Display the color
  12.       printf "\e[${fgbg};5;%sm  %3s.%s  \e[0m" $color $color $fgbg
  13.       # Display 6 colors per lines
  14.       if [ $((($color + 1) % 6)) == 4 ] ; then
  15.          echo # New line
  16.       fi
  17.    done
  18.    echo # New line
  19. done
  20.  
  21. # This program is free software. It comes without any warranty, to
  22. # the extent permitted by applicable law. You can redistribute it
  23. # and/or modify it under the terms of the Do What The Fuck You Want
  24. # To Public License, Version 2, as published by Sam Hocevar. See
  25. # http://sam.zoy.org/wtfpl/COPYING for more details.
  26.  
  27. #Background
  28. for clbg in {40..47} {100..107} 49 ; do
  29.     #Foreground
  30.     for clfg in {30..37} {90..97} 39 ; do
  31.         #Formatting
  32.         for attr in 0 1 2 4 5 7 ; do
  33.             #Print the result
  34.             echo -en "\e[${attr};${clbg};${clfg}m ^[${attr};${clbg};${clfg}m \e[-1m"
  35.         done
  36.         echo #Newline
  37.     done
  38. done
  39.  
  40. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement