bash:colors:24-bit_rgb_colors
Table of Contents
BASH - Colors - 24-bit RGB Colors
16777216 Colors.
Format
ESC[ 38;2;⟨r⟩;⟨g⟩;⟨b⟩ m Select RGB foreground color ESC[ 48;2;⟨r⟩;⟨g⟩;⟨b⟩ m Select RGB background color
where:
- R is RED; values 0 to 255.
- G is GREEN; values 0 to 255.
- B is BLUE; values 0 to 255.
RED Example
echo -e "\033[38;2;155;0;0mThis is in RED"
ANSI Rainbow
for (( r = 0; r < 255; r++ )); do for (( g = 0; g < 255; g++ )); do for (( b = 0; b < 255; b++ )); do echo -e "\033[38;2;"$r";"$g";"$b"mHello $r $g $b"; done done done
bash/colors/24-bit_rgb_colors.txt · Last modified: 2021/01/09 13:35 by peter