There is no dedicated function to do this, because you can just do exactly this by using the HSV color model. Hue (H) controls the color it self, S stands for saturation of the color and V is called lightness or value. That is what you try to control. Just set the LEDs color to a HSV value and change it's V value:
leds[i] = HSV(color, saturation, brightness);
saturation are staying the same (to keep the same color), you can change the brightness directly with the thirds value. Note, that
leds[i] is still defined as
CRGB, not as
HSV. This assigment uses an implicit conversion, that is defined in the library.
You can see the usage of
HSV in the
Cylon example of the FastLED library. There it is the Hue value, that get's changed, but it is the same principle with the brightness.
Now there is a problem to solve: The FastLED library can convert HSV colors to RGB colors, but not the other way round. So you cannot simply get the hue and saturation of an RGB color with this library. You can go 2 ways here:
You can just define an extra LEDs array with HSV colors and synchronize both arrays to contain the same data (everytime you want to change a color, you would set a HSV color in the second array, convert that array to RGB by using
CRGB(hsv_leds[i]) and save that in the first array, which get's used by the FastLED library). This is relatively easy, but you effectively need double the memory for storing the color values. This is not an issue, if you have enough memory or few enough LEDs to control.
You can write your own function to convert RGB values to HSV, then use it to access the hue and saturation values of the targeted RGB color, create a new HSV color with it and the new brightness and use it to set the RGB values for the FastLED library. In this forum thread there is a brief discussion about that, though it leaves you with the implementation yourself. I think there are suitable implementations, that can be found on the web. A quick search gave me this code from github gist. I have not tested it, so I cannot say, if it really works correctly, but you should give it a try. I'm sure there are also other implementations.