What looks good with #AFC398?
February 4, 2011 2:40 PM Subscribe
Programmers: know any good algorithms for picking colors, modifying colors or choosing colors that go well together? This is specifically for code. I'm NOT looking for apps that let you choose colors.
posted by grumblebee to computers & internet (15 answers total) 34 users marked this as a favorite
I'm not trying to solve a particular problem right now. But I often find that, when programming, I need to generate pleasing colors. I know that the best way to do this is to use a human eye, but imagine you were writing a program that filled the screen with random dots of various colors, but you wanted the colors to look good together.
Or you have a UI where the user gets to pick the background color, and you want to choose harmonious colors that go with his choice.
I know basic color theory. I understand the color wheel. So I could probably create most of these myself, but I'm wondering if there's a good resources for them online, something that works for C-family languages.
I am specifically coding in Actionscript, but I can convert stuff over from Java, C or whatever.
Actionscript generally deals with colors as hex values -- NOT AS STRINGS THAT LOOK LIKE HEXES. (I keep finding code on the web that accepts "#FF0000" and chops off the "#," and then proceeds to do all sorts of string-to-number parsing. I don't need anything like that.)
But I can convert a hex value into r-g-b values if necessary (and vice versa).
Examples of what I'm looking for are:
pickComplimentaryColor( inputColor );
returnArrayOfColorsThatGoWith( inputColor, numColorsWanted );
generatePastelColorsFromThisBaseColor( inputColor, numColorsWanted );
generateMetalicColorsFromThisInputColor( inputColor, numColorsWated );
darkenThisColor( inputColor, byThisPercent );
lightenThisColor( inputColor, byThisPercent );
randomColorThatGoesWith( inputColor );
rondomColorNearThisColor( inputColor );
I would love a huge library of cool manipulation functions!