Re: Really Big Colour Code: 117313504
 February 11, 2013 02:29PM Standards Committee Member Registered: 3 years agoPosts: 185
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
Eric Himbeault938January 11, 2013 08:32AM
Travis Cobbs339January 11, 2013 09:14AM
Travis Cobbs324January 11, 2013 09:17AM
Eric Himbeault336January 11, 2013 01:49PM
Travis Cobbs308January 11, 2013 02:38PM
Allen Smith372January 11, 2013 04:06PM
Travis Cobbs375January 11, 2013 04:49PM
Alex Taylor344January 12, 2013 05:38AM
Michael Heidemann340January 12, 2013 04:05PM
Alex Taylor350January 13, 2013 04:05AM
Michael Heidemann336January 13, 2013 10:35AM
Eric Himbeault310January 14, 2013 08:21AM
Roland Melkert430February 11, 2013 11:13AM
Michael Heidemann353February 11, 2013 02:00PM
Travis Cobbs379February 11, 2013 02:01PM
Allen Smith352February 11, 2013 02:29PM
Travis Cobbs343February 11, 2013 03:27PM
Travis Cobbs359February 11, 2013 03:30PM
Allen Smith360February 11, 2013 04:36PM
Martin James377February 12, 2013 12:51AM
Roland Melkert672February 12, 2013 11:43AM

Sorry, only registered users may post in this forum.