Palette 0.7.6: CIE CAM16, color theory schemes, and some more (ogeon.github.io)
from Ogeon@programming.dev to rust@programming.dev on 28 Apr 2024 13:35
https://programming.dev/post/13367573

The maintainer here! Feel free to ask questions. I know especially CAM16 can feel a bit abstract if you aren’t in the loop, but I will try to answer what I can. I have tried my best to explain the concepts in the docs, but it can always be better.

#rust

threaded - newest

ExperimentalGuy@programming.dev on 29 Apr 2024 00:00 collapse

This looks like a really cool library, but I don’t have any experience in color. Are there any resources you’d recommend to learn before/while using this library?

Ogeon@programming.dev on 29 Apr 2024 08:25 collapse

This depends a bit on what you are looking for. The library documentation is supposed to guide you to a practical starting point, but it’s still quite light on the theoretical parts. I haven’t really collected any specific beginner material, so this may still be a bit technical. There’s a ton of info about the basics, with varying levels of detail.

Assuming you are starting from almost nothing, I would recommend getting familiar with what RGB is and how its components relate. This is the format most images are encoded in and most devices and software use. The Wikipedia page is quite thorough, so no need to read all of it: en.wikipedia.org/wiki/RGB_color_model

Next, it’s good to know there are other models. HSV and HSL tend to be used in color pickers (a bit more intuitive than RGB), so you have probably interacted with them at some point. Again, the Wikipedia page may be a good source: en.wikipedia.org/wiki/HSL_and_HSV

That’s often good enough for producing colors and reading or writing images. If you want to go more into editing, it’s good to know that you will need to massage the values you get from the images. They usually don’t represent the actual light intensities, so they have to be made linear. Palette offers functions for it and represents it in the type system. This video is a slightly simplified explanation of the problem (when it mentions the square root, it’s an approximation): youtu.be/LKnqECcg6Gw

At some point, you will realize that neither linear nor non-linear RGB is the universal answer to good looking colors. They are used in different situations. There is another category of color models/spaces that are called “perceptually uniform”, meaning that they try to simulate or predict how we actually experience the colors and relate it to the numbers in the computer. This page shows the problem and introduces one of those models: bottosson.github.io/posts/colorwrong

I can probably provide more sources if you have any specific things you want to read about, but this is a start.

ExperimentalGuy@programming.dev on 29 Apr 2024 14:01 collapse

Omg there’s a lot more than I realized there would be. I really appreciate going out if your way like this!

Ogeon@programming.dev on 29 Apr 2024 17:01 collapse

The rabbit hole goes deep if you really feel like going spelunking. A basic understanding of RGB, HSV and HSL takes you very far and lets you do a lot of things already. It’s good enough as long as it looks good, after all. 🙂

You really don’t need to read all of it to get started!