Ages ago, I wrote a little script to change the page background to a shifting rainbow pattern when a visitor presses B on their keyboard; I finally got around to adding a localstorage function to it, so the settings sticks from page to page until the visitor hits B again. You can see it in action here. Thought it may be of interest to someone, so:
In short, color interpolation method gives you control over the colour space used to interpolate between colours (e.g. sRGB, HSL, OKLCH, etc.), and hue interpolation method specifies how the midpoint between the hues of colours is calculated.
The hue part is pretty slick. If we imagine a colour wheel, and we wanted to create a gradient from red to red, well, we would get a solid colour as the output, i.e. the hue wouldn’t change from one end of the gradient to the other.
But by dictating a hue interpolation method of longer hue, the midpoint will be on the opposite side of red on the colour wheel, which results in the gradient sweeping through the entire colour wheel to get from red all the way to red again.
This means you can create gradients with a lot less code, e.g.
Unfortunately, this doesn’t give as fine-grained control over the exact colours to interpolate between in a gradient, but it does take away the work of finding equidistant points along a gradient to interpolate between to avoid sharp changes and/or banding in a gradient—the browser does that work for you instead.
Now I’m thinking about a way to add mobile support. Can’t press B on a smartphone, so maybe I’ll turn the B in the title banner into a secret button - not sure yet.