This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
bash:tip_colors_and_formatting [2017/09/01 12:24] 127.0.0.1 external edit |
bash:tip_colors_and_formatting [2017/11/08 08:29] flozz [256 colors] |
||
---|---|---|---|
Line 37: | Line 37: | ||
| 5 | Blink ((Does not work with most of the terminal emulators, works in the tty and XTerm.)) | <code bash>echo -e "Normal \e[5mBlink"</code> | {{:bash:colors_format:vt100_format_05_blink.gif?nolink|Normal Blink}} | | | 5 | Blink ((Does not work with most of the terminal emulators, works in the tty and XTerm.)) | <code bash>echo -e "Normal \e[5mBlink"</code> | {{:bash:colors_format:vt100_format_05_blink.gif?nolink|Normal Blink}} | | ||
| 7 | Reverse (invert the foreground and background colors) | <code bash>echo -e "Normal \e[7minverted"</code> | {{:bash:colors_format:vt100_format_07_inverted.png?nolink|Normal inverted}} | | | 7 | Reverse (invert the foreground and background colors) | <code bash>echo -e "Normal \e[7minverted"</code> | {{:bash:colors_format:vt100_format_07_inverted.png?nolink|Normal inverted}} | | ||
- | | 8 | Hidden (usefull for passwords) | <code bash>echo -e "Normal \e[8mHidden"</code> | {{:bash:colors_format:vt100_format_08_hidden.png?nolink|Normal Hidden}} | | + | | 8 | Hidden (useful for passwords) | <code bash>echo -e "Normal \e[8mHidden"</code> | {{:bash:colors_format:vt100_format_08_hidden.png?nolink|Normal Hidden}} | |
==== Reset ==== | ==== Reset ==== | ||
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 6 colors per lines |
- | if [ $((($color + 1) % 10)) == 0 ] ; then | + | if [ $((($color + 1) % 6)) == 4 ] ; then |
- | echo #New line | + | echo # New line |
- | fi | + | fi |
- | done | + | done |
- | echo #New line | + | echo # New line |
done | done | ||