6/1/2026 at 11:01:31 PM
This problem of what exactly a color value means is mostly inconsequential when you have 8 bits per component, the difference in the denominator being either 255 or 256 makes the errors tiny, you must have really good color perception and get really close to the screen to see any difference at all, and your monitor/phone screen is probably not calibrated anyway, so who cares.It becomes a pain in the ass when you're generating a VGA signal with a microcontroller with 8 color output pins (3 red, 3 green, 2 blue). The meaning of a color value is very real in this setup: it corresponds to a voltage level you must send to the VGA monitor, 0V-0.7V.
So the blue channel will map (0->0V, 1->0.23V, 2->0.47V, 3->0.7V), and the red/green will map (0->0V, 1->0.1V, ..., 7->0.7V). Notice how none of the blue voltages match any of the red/green ones (other than the extremes)? That means you don't get to see any pure grays -- the closest ones will have bit of blue or yellow tint, depending on the direction of the difference.
Not only that, any gradients at all (other than the ones not mixing blue with the other channels) will be noticeable off: for example, the closest colors in the line between pure red to pure white will all be slightly orange or purple.
Code for VGA output in 8-bit color with double-buffered 320x240 framebuffer for the Raspberry Pi Pico 2 here, if anyone cares: https://github.com/moefh/pico-vga-8bit-demo
by moefh
6/2/2026 at 2:02:32 AM
>our monitor/phone screen is probably not calibrated anyway,I'm not convinced this holds nowadays, the higher end/flagship phones seem to have commonly have calibrated screens nowadays. Usually they have a high saturation profile loaded as default, but the 'realistic' profile usually turns out to be pretty well calibrated. Similarly with laptops and monitors. I've tried using a colorimeter on my recent devices only to find that the display was already calibrated pretty well.
by hgoel
6/2/2026 at 12:50:44 AM
You forgot about gamma correction. Before converting a value in the range of 0-255 into a voltage, PCs typically raise that value to the power of 2.2. This makes the difference between small values and large values far more apparent:2^2.2 = 4.595, 255^2.2 = 196,964.699
by chongli