I am the creator of that image.
The image on the right is rendered using a color look-up texture. In the final GLSL shader, I apply the dither, then convert the RGB values into integers in the range 0<=x<40, combine them into a single index, then look up the resulting color value in this image:
The lowest row is the raw palette.
The image to the left is made purely in the shader by downsampling the red and green channels to 8 values, and the blue channel to 4 values after applying the dither, resulting in RGB332. I've also played around with 7 red, 9 green and 4 blue shades, resulting in only 252 colors, but with a bigger emphasis on green, which the human eye is the most sensitive to.