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:


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