Half way between red and green? What's half way between red and green?

Half way between red and green?
What’s half way between red and green? Or between cyan and pink? It turns out that there is no one answer. There are literally dozens of ways to interpolate between two colors, and which one you choose depends entirely on what you want to get out of it.
Here’s a great little chart showing how colors interpolate in different color spaces and with different transition vectors.
http://howaboutanorange.com/blog/2011/08/10/color_interpolation/

In FastLED, fill_gradient uses HSV interpolation (the third row on this chart) . Some forthcoming code (RGB palettes) will use sRGB (the first row).

If anyone decides to implement CIELAB Lab* color in AVR assembly, let me know…

2 years ago I wrote a RGB fade function for soft crossfading between different frames. When I´m at home again (next week) I´ll make a video and show the code.

Was it an RGB colorspace cross fade?

Yes. If I remember right with an adjustable number of linear interpolated frames. It looked really smooth and nice. Except with very low color values, but that was before temporal dithering…

Ha! Found an old piece of code on my laptop. Example follows.

void fade_from_old_to_new_frame(int steps) {

for(int a=0; a < steps; a++){
for(int b=0; b < NUM_LEDS; b++){

  leds[b].r = (int)old_frame[b][0] + ((int)new_frame[b][0] - (int)old_frame[b][0]) * a /steps;
  leds[b].g = (int)old_frame[b][1] + ((int)new_frame[b][1] - (int)old_frame[b][1]) * a /steps;
  leds[b].b = (int)old_frame[b][2] + ((int)new_frame[b][2] - (int)old_frame[b][2]) * a /steps; }

FastSPI_LED.show(); }
}

I had stashed away some color blending info about the CIE Lch colorspace vs. CIE lab. The essence being that CIE Lch is better able to maintain the saturation and brightness.

Anyway, I don’t pretend to understand this, but I thought you might find it interesting.

http://www.stuartdenman.com/improved-color-blending/
http://www.colourphil.co.uk/lab_lch_colour_space.shtml
http://www.getreuer.info/home/colorspace

Thanks, Paul! I actually had bookmarked that first page myself.

I’d love to use the CIELab space for color transitions, but the math makes it more expensive than I want to ‘spend’ for each pixel in a large loop on a small device.

I mean, SOMEONE out there probably wants CIELab or CIELch gradients, and is willing to put up with low frame rates to get them, but at this point I figure that’s up to that impassioned colorhacker to code up, and not a good candidate for the FastLED library itself. But who knows! I’ll look at the math again and see if I can think how to make it scream on an 8-bit 16MHz MCU!

The CIELab gradients sure are nice though…

Yup. I didn’t know whether this would be useful, just interesting. And yeah the math is crazy.