As a developer, managing colors can be tedious, but there are “developer friendly” solutions, HSLuv is one of them and I will explain what it is and how it can help.

The problem with traditional color spaces

Traditionally in computing, we use RGB or HSL.

The problem with those color spaces is that they are non linear in term of human perception.

RGB

For example, let’s take the following stepped gradients, they are all composed of even spaced RGB colors.

We can see a few things:

Ok, RGB is how pixels are rendered, it was never designed to have “manipulable” values, so this is to be expected.

HSL

Let’s try the same with HSL. HSL is supposed to be much easier to work with, because we can keep the hue constant and modify the other two values.