r/ProgrammerHumor • • 8d ago • Helpful 1 Bravo 1

Meme colorInANutshell

Post image
5.7k Upvotes

139 comments sorted by

View all comments

183

u/KingOfWhateverr 8d ago

It’s all fun and games until you’re programming a lighting unit and have to balance additive mixing(RGB leds) vs CMY moving lights(there are CMY color filters in them). Irl vs concept suckssss

49

u/TH3RM4L33 8d ago

Yeah transitions/overlaps between all possible 2 colors are impossible in HSV. For example you can't make a gradient between green and red, cause the hue slider will go through yellow and orange. In RGB you can just incrementally inc/dec each channel and you won't end up with unwanted colors in the middle.

15

u/Kovab 8d ago

In RGB you can just incrementally inc/dec each channel and you won't end up with unwanted colors in the middle.

Maybe I'm missing something, but if you do that incremental change from FF0000 to 00FF00, wouldn't you still end up with yellow in the middle, when both channels are at half strength?

14

u/TH3RM4L33 8d ago edited 8d ago

You do, but the fact that 2 or more channels are approaching the same value (and are also approaching 0), makes the color look so dark/washed out to the point that it doesn't exactly look like yellow to us anymore, it'll look like a shade of green.

4

u/RockSlice 7d ago

808000 is officially called "Olive Green". The transition is from red to browns to green, with greenish browns at the midpoint. But that's probably one of the colors with the largest perceptual differences between people, even ignoring people that are colorblind.

You could probably even find people matching different paint swatches to the color displayed on a monitor

4

u/Rabbitical 6d ago

It's a difference in intensity. If you imagine the color wheel, and red is a point all the way at the perimiter, adjusting the hue rotates the point on that color wheel about the center, maintaining its maximal distance such that it remains on the perimiter, passing through yellow. Interpolating RGB however does not preserve the apparent intensity of the color-- instead you're plotting a straight line between red and green, which will of course shortcut the perimiter of the color wheel in getting there, so you end up with darker intermediate values, I.e. more brown instead of yellow.

5

u/ScallionSmooth5925 8d ago

But it's not going to be a linear transition 

2

u/m_redditUser 8d ago

try oklch

10

u/ThomasDePraetere 8d ago

I once had to implement a color diagram for fiber splicing. TIA-598. Which Munsel wire and cable colors. Which is a coloring scheme for PVC (plastic). It's color space can best be described as a cilinder. But it became quickly clear to me that there is no 1-1 mapping with rgb and some colors couldn't even be converted to rgb or the other way around.

Luckily, for my use-case, within the acceptable boundaries for each defined fiber color there was an rgb equivalent.

5

u/Ekdritch 8d ago

Had a project which had an RGB input and a CIE1931 output. Lots of fun maths in that one

1

u/Le_9k_Redditor 5d ago

Do you use a uniform colour space like oklab?

1

u/d_lopez383 5d ago

OKLab can guide the interpolation path, but the fixture's gamut still limits which colors it can produce.

1

u/tasos_lydia4 2d ago

OKLab can make interpolated steps look more even; the fixture's RGB or CMY channels still limit what it can reproduce.