Sign in to follow this  
quasty

changing color, preserving luminance

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

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