Understanding root color indexes

Found the issue: if you change in this function the 257 to 256, it will get solved:

void TColor::Pixel2RGB(ULong_t pixel, Int_t &r, Int_t &g, Int_t &b)
{
   ColorStruct_t color;
   color.fPixel = pixel;
   gVirtualX->QueryColor(gVirtualX->GetColormap(), color);
   // color is between 0 and 65535 inclusive. We need to move it to the 0 to 255 range (inclusive). So we need to resample the 65536 values into 256 indices. This would mean equal blocks of 256 high-res values per color index.
   r = color.fRed / 257;
   g = color.fGreen / 257;
   b = color.fBlue / 257;
}

so maybe the problem is in all X11 ?

See maybe related comment new methods AllocColor() and QueryColors() that reduce the expensive · root-project/root@a09e286 · GitHub

and I proposed PR:

1 Like