3 # This file echoes four gradients with 24-bit color codes
4 # to the terminal to demonstrate their functionality.
5 # The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
6 # The background escape sequence is ^[48;2;<r>;<g>;<b>m
7 # <r> <g> <b> range from 0 to 255 inclusive.
8 # The escape sequence ^[0m returns output to default
12 # https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh
13 # and presumably covered by
14 # https://github.com/gnachman/iTerm2/blob/master/LICENSE
18 if which gseq
>/dev
/null
2>&1; then
20 elif seq --version|
grep -q GNU
; then
23 if [ -n "$SEQ1" ]; then
24 # GNU seq requires a -ve increment if going backwards
27 if [ $1 -gt $2 ]; then
41 echo -en "\033[48${SEPARATOR}2${SEPARATOR}$1${SEPARATOR}$2${SEPARATOR}$3""m"
49 # Gives a color $1/255 % along HSV
50 # Who knows what happens when $1 is outside 0-255
51 # Echoes "$red $green $blue" where
52 # $red $green and $blue are integers
53 # ranging between 0 and 255 inclusive
80 # execution should never reach here
85 for i
in `$SEQ 0 127`; do
86 setBackgroundColor
$i 0 0
90 for i
in `$SEQ 255 128`; do
91 setBackgroundColor
$i 0 0
96 for i
in `$SEQ 0 127`; do
97 setBackgroundColor
0 $i 0
101 for i
in `$SEQ 255 128`; do
102 setBackgroundColor
0 $i 0
107 for i
in `$SEQ 0 127`; do
108 setBackgroundColor
0 0 $i
112 for i
in `$SEQ 255 128`; do
113 setBackgroundColor
0 0 $i
118 for i
in `$SEQ 0 127`; do
119 setBackgroundColor
`rainbowColor $i`
123 for i
in `$SEQ 255 128`; do
124 setBackgroundColor
`rainbowColor $i`