16777216 Colors.
ESC[ 38;2;⟨r⟩;⟨g⟩;⟨b⟩ m Select RGB foreground color ESC[ 48;2;⟨r⟩;⟨g⟩;⟨b⟩ m Select RGB background color
where:
echo -e "\033[38;2;155;0;0mThis is in RED"
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