Sign in to follow this  

changing color, preserving luminance

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 somehow
color = 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.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this