Ok I see now. I would need to to another table to convert from the 8-bit waveform back to rrggbb, which is my color depth.

I think for now I will implement only the CGA 16-composite modes as they are pretty simple. I will dig more into this later. Thxs.