But this is not quite straightforward why. TAttLine documentation says that DrawColorTable() shows “the first 50 default colors”, implying that there must be a way to change these default values (in my opinion the user expect this behaviour when changing the palette, but anyway).
I cannot figure out the way to achieve this. Can anybody point me to the right documentation or explain it ?
Ok, I figured it out (the right term to search for was TColor). To change a color of the current (1D) palette :
Then calling SetLineColor(5) will get the red color. It should be easy to play with this to obtain a smooth palette like this one, but isn’t there a cleaner/preferred method than changing all the default values manually ?
Ok, now I get it. The simplest way to define one’s own 1D palette is to define a custom palette as explained almost everywhere (for instance on TColor’s doc or here), then to call :
which will give the index of the first color defined in this palette. Then you just have to call SetLineColor or whatever starting from this index up to this index plus the number of colors defined in your custom palette.
Maybe this could be made more clear in the documentation — unless I missed something, obviously.
BTW, maybe the DrawColorTable could be adapted to DrawColorTable(int index, int ncolors) to show the table of the ncolors starting from index.