Quantizing RGB to a Specific Number of Bits


Maybe this feature already exists but I cannot find it. I would like the ability to independently set the number of bits per R, G, B, so instead of 8 bits, I would like to set them to, say, 3,3,3 or 3,3,2 or 5,6,5 and so on. Creating a gradient, or selecting a colour with the picker, etc… should quantise to these bit settings.

Does this functionality exist? If not, even an extension to be able to select a range of colours and running a quantise operation would be a huge help