Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
bash:tip_colors_and_formatting [2017/09/07 06:51]
flozz [Set]
bash:tip_colors_and_formatting [2017/11/08 08:29]
flozz [256 colors]
Line 212: Line 212:
 ==== 256 colors ==== ==== 256 colors ====
  
-{{ :​bash:​colors_format:​256-colors.sh.png?​nolink|Screenshot of the 256-colors.sh script}}+{{ :​bash:​colors_format:​256-colors.sh-v2.png?nolink&​height=200|Screenshot of the 256-colors.sh script}}
  
 The following script display the 256 colors available on some terminals and terminals emulators like **XTerm** and **GNOME Terminal**. The following script display the 256 colors available on some terminals and terminals emulators like **XTerm** and **GNOME Terminal**.
Line 225: Line 225:
 # http://​sam.zoy.org/​wtfpl/​COPYING for more details. # http://​sam.zoy.org/​wtfpl/​COPYING for more details.
  
-for fgbg in 38 48 ; do #​Foreground/​Background +for fgbg in 38 48 ; do # Foreground / Background 
- for color in {0..256} ; do #Colors +    for color in {0..255} ; do # Colors 
- #Display the color +        # Display the color 
- echo -en "​\e[${fgbg};​5;​${color}m ${color}\t\e[0m"​ +        ​printf ​"​\e[${fgbg};​5;​%sm  %3s  ​\e[0m" ​$color $color 
- #​Display ​10 colors per lines +        # Display ​colors per lines 
- if [ $((($color + 1) % 10)) == ] ; then +        if [ $((($color + 1) % 6)) == ] ; then 
- echo #New line +            echo # New line 
- fi +        fi 
- done +    done 
- echo #New line+    echo # New line
 done done
  
 
bash/tip_colors_and_formatting.txt · Last modified: 2018/08/09 09:14 by flozz