Welcome! Log In Create A New Profile

Advanced
Re: Really Big Colour Code: 117313504
avatarFebruary 11, 2013 02:29PM
I derive a color algorithmically. I actually prefer this method over trying to define compliment colors by hand.

//========== complimentColor() =================================================
//
// Purpose:     Changes the given RGBA color into a "complimentary" color, which 
//              stands out in the original color, but maintains the same hue.
//
//==============================================================================
void complimentColor(const GLfloat *originalColor, GLfloat *complimentColor)
{
    float   brightness      = 0.0;
    
    // Isolate the color's grayscale intensity http://en.wikipedia.org/wiki/Grayscale
    brightness =    originalColor[0] * 0.30
                +   originalColor[1] * 0.59
                +   originalColor[2] * 0.11;
    
    //compliment dark colors with light ones and light colors with dark ones.
    if(brightness > 0.5)
    {
        // Darken
        complimentColor[0] = MAX(originalColor[0] - 0.40,   0.0);
        complimentColor[1] = MAX(originalColor[1] - 0.40,   0.0);
        complimentColor[2] = MAX(originalColor[2] - 0.40,   0.0);
    }
    else
    {
        // Lighten
        complimentColor[0] = MIN(originalColor[0] + 0.40,   1.0);
        complimentColor[1] = MIN(originalColor[1] + 0.40,   1.0);
        complimentColor[2] = MIN(originalColor[2] + 0.40,   1.0);
    }
    
    complimentColor[3] = originalColor[3];
    
}//end complimentColor

SubjectAuthorViewsPosted
Really Big Colour Code: 117313504 Eric Himbeault768January 11, 2013 08:32AM
Re: Really Big Colour Code: 117313504 Travis Cobbs283January 11, 2013 09:14AM
Re: Really Big Colour Code: 117313504 Travis Cobbs258January 11, 2013 09:17AM
Re: Really Big Colour Code: 117313504 Eric Himbeault274January 11, 2013 01:49PM
Re: Really Big Colour Code: 117313504 Travis Cobbs246January 11, 2013 02:38PM
Re: Really Big Colour Code: 117313504 Allen Smith299January 11, 2013 04:06PM
Re: Really Big Colour Code: 117313504 Travis Cobbs302January 11, 2013 04:49PM
Re: Really Big Colour Code: 117313504 Alex Taylor287January 12, 2013 05:38AM
Re: Really Big Colour Code: 117313504 Michael Heidemann283January 12, 2013 04:05PM
Re: Really Big Colour Code: 117313504 Alex Taylor285January 13, 2013 04:05AM
Re: Really Big Colour Code: 117313504 Michael Heidemann266January 13, 2013 10:35AM
Re: Really Big Colour Code: 117313504 Eric Himbeault256January 14, 2013 08:21AM
Re: Really Big Colour Code: 117313504 Roland Melkert362February 11, 2013 11:13AM
Re: Really Big Colour Code: 117313504 Michael Heidemann293February 11, 2013 02:00PM
Re: Really Big Colour Code: 117313504 Travis Cobbs309February 11, 2013 02:01PM
Re: Really Big Colour Code: 117313504 Allen Smith275February 11, 2013 02:29PM
Re: Really Big Colour Code: 117313504 Travis Cobbs279February 11, 2013 03:27PM
Re: Really Big Colour Code: 117313504 Travis Cobbs289February 11, 2013 03:30PM
Re: Really Big Colour Code: 117313504 Allen Smith285February 11, 2013 04:36PM
Re: Really Big Colour Code: 117313504 Martin James308February 12, 2013 12:51AM
Re: Really Big Colour Code: 117313504 Roland Melkert546February 12, 2013 11:43AM



Sorry, only registered users may post in this forum.

Click here to login