Say I throw out a random color like #3080c0. What color matches it such that the two together look good? e.g. What's a good background color to #3080c0 as a foreground color?
Printable View
Say I throw out a random color like #3080c0. What color matches it such that the two together look good? e.g. What's a good background color to #3080c0 as a foreground color?
like color schemes?
I'm possibly looking for complimentary, but that site's complimentary uses 5 colors, and it doesn't quite tell how it's generated. Is the hue just shifted by like 90 or 180 or whatever it is?
I did some research and this was a snippet i found.
Hope this helps ya chiefCode:<?PHP
FUNCTION inverseHex( $color )
{
$color = TRIM($color);
$prependHash = FALSE;
IF(STRPOS($color,'#')!==FALSE) {
$prependHash = TRUE;
$color = STR_REPLACE('#',NULL,$color);
}
SWITCH($len=STRLEN($color)) {
CASE 3:
$color=PREG_REPLACE("/(.)(.)(.)/","\\1\\1\\2\\2\\3\\3",$color);
CASE 6:
BREAK;
DEFAULT:
TRIGGER_ERROR("Invalid hex length ($len). Must be (3) or (6)", E_USER_ERROR);
}
IF(!PREG_MATCH('/[a-f0-9]{6}/i',$color)) {
$color = HTMLENTITIES($color);
TRIGGER_ERROR( "Invalid hex string #$color", E_USER_ERROR );
}
$r = DECHEX(255-HEXDEC(SUBSTR($color,0,2)));
$r = (STRLEN($r)>1)?$r:'0'.$r;
$g = DECHEX(255-HEXDEC(SUBSTR($color,2,2)));
$g = (STRLEN($g)>1)?$g:'0'.$g;
$b = DECHEX(255-HEXDEC(SUBSTR($color,4,2)));
$b = (STRLEN($b)>1)?$b:'0'.$b;
RETURN ($prependHash?'#':NULL).$r.$g.$b;
}
// Demo
// echo inverseHex('#000000'); // #ffffff
?>
da fuck is inverse. 180 away on the color wheel?
ya right across
like orange - blue
red - green
purple - yellow
http://www.tigercolor.com/color-lab/...-wheel-300.gif
What about lightness? Wouldn't you reverse it? I assume that'd just be the absolute value of 255 minus the original color's lightness.
ugh i wanted to use rgb for the math, not hsl :(
idk #'s man
y u gotta make it about numbers
Writing algorithms mang.