• 13
• 18
• 19
• 27
• 10

# changing color, preserving luminance

This topic is 4262 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, does anybody knows how do I modify a RGB color vaue (for example make it 10% more yellow or 5% less red) but preserve the luminance of the color value? thank you

##### Share on other sites
The easiest way would be to convert to the HSL colour space, then mess with the H and S values, then convert back again.

##### Share on other sites
You can define the luminance as (min(R,G,B)+max(R,G,B))/2. Then do something like the following pseudo-code:
original_luminance = luminance(color);// modify color somehowcolor = color * (original_luminance / luminance(color));

Well, at least that's the luminance they use in HSL. You can try to use a different definition, something like .3*R + .59*G + .09*B. You may have to do some gamma correction too. See which of the definitions produces the results you want.