cout << “\033[22;31m” << “Hello!” << endl;
Which will print: Hello!
The list of codes is as follows:
\033[22;30m - black
\033[22;31m - red
\033[22;32m - green
\033[22;33m - brown
\033[22;34m - blue
\033[22;35m - magenta
\033[22;36m - cyan
\033[22;37m - gray
\033[01;30m - dark gray
\033[01;31m - light red
\033[01;32m - light green
\033[01;33m - yellow
\033[01;34m - light blue
\033[01;35m - light magenta
\033[01;36m - light cyan
\033[01;37m – white
\033[0m – default terminal text colour
It may be worth looking into using a different colour space to find a path that goes through the correct hues and then convert the desired point to RGB.
It has been a while since I did anything like this but I remember something about Planckian locus (mired scale) having a smooth transition from blue to red via orange.
/* IGNORE THIS POST */
Wait... 16Bit Colour... A 0-255 range uses 8 bits. How can you store 3 8-bit colours into a 1 16-bit colour? Why not using a 32bit?
And, i suggest you to have bit-shifting, that's faster. /* IGNORE THIS POST */
I changed it to this:
The ConvertTPAData function converts the 16 bit integer to a actual temperture...
1 2 3 4 5 6 7 8 9
double val = ConvertTPAData(item.tpa8[x]);
int B = 255 - (int)((val / 20) * 255);
int G = 255 - (int)((Math.Abs(val - 20) / 90) * 255);
int R = (int)(((val - 15) / 25) * 255);
R = R > 255 ? 255 : ( R < 0 ? 0 : R );
G = G > 255 ? 255 : ( G < 0 ? 0 : G );
B = B > 255 ? 255 : ( B < 0 ? 0 : B );