Ogeon / palette

A Rust library for linear color calculations and conversion
Apache License 2.0
749 stars 60 forks source link

Clear up the luma vs. luminosity mixup #399

Open Ogeon opened 3 months ago

Ogeon commented 3 months ago

The current Luma type isn't actually representing luma. It's relative luminosity with or without gamma compression, which is fine and what's usually encoded in grayscale images if I understand correctly. The problem is that the terminology is misleading for anyone who actually wants luma.

The difference is that to get the relative luminosity from RGB, the linear values are used. To get the luma, the gamma compressed values are used. It's possible that the coefficients can be different for luma too, but I need to look into that.

What to do? I think the simple solution is to rename Luma. I'm not sure there's a need for an actual luma type, but that one can take the name in that case.

Let me know if you have naming suggestions. I'm thinking about calling it Luminance, but something easier to understand is also an option.

Ogeon commented 2 months ago

"Mono" for monochrome is also an option. More neutral.