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 Himbeault780January 11, 2013 08:32AM
Re: Really Big Colour Code: 117313504 Travis Cobbs284January 11, 2013 09:14AM
Re: Really Big Colour Code: 117313504 Travis Cobbs262January 11, 2013 09:17AM
Re: Really Big Colour Code: 117313504 Eric Himbeault277January 11, 2013 01:49PM
Re: Really Big Colour Code: 117313504 Travis Cobbs248January 11, 2013 02:38PM
Re: Really Big Colour Code: 117313504 Allen Smith303January 11, 2013 04:06PM
Re: Really Big Colour Code: 117313504 Travis Cobbs309January 11, 2013 04:49PM
Re: Really Big Colour Code: 117313504 Alex Taylor291January 12, 2013 05:38AM
Re: Really Big Colour Code: 117313504 Michael Heidemann285January 12, 2013 04:05PM
Re: Really Big Colour Code: 117313504 Alex Taylor291January 13, 2013 04:05AM
Re: Really Big Colour Code: 117313504 Michael Heidemann272January 13, 2013 10:35AM
Re: Really Big Colour Code: 117313504 Eric Himbeault258January 14, 2013 08:21AM
Re: Really Big Colour Code: 117313504 Roland Melkert363February 11, 2013 11:13AM
Re: Really Big Colour Code: 117313504 Michael Heidemann298February 11, 2013 02:00PM
Re: Really Big Colour Code: 117313504 Travis Cobbs315February 11, 2013 02:01PM
Re: Really Big Colour Code: 117313504 Allen Smith283February 11, 2013 02:29PM
Re: Really Big Colour Code: 117313504 Travis Cobbs283February 11, 2013 03:27PM
Re: Really Big Colour Code: 117313504 Travis Cobbs296February 11, 2013 03:30PM
Re: Really Big Colour Code: 117313504 Allen Smith292February 11, 2013 04:36PM
Re: Really Big Colour Code: 117313504 Martin James314February 12, 2013 12:51AM
Re: Really Big Colour Code: 117313504 Roland Melkert552February 12, 2013 11:43AM



Sorry, only registered users may post in this forum.

Click here to login