Please note!

This is an archived, inactive copy of
"Over mango and chocolate crepes"

Please do not link to this page.


September 16, 2006

Over mango and chocolate crepes

Posted by bopuc at September 16, 2006 03:37 PM

I coded up a little tiny PHP method that takes any text string and returns 5 usable "html" hexadecimal colors.

It's not as artful as I'd have liked it to be, but then again my programming skills are not everything I'd like them to be either. ;)

$name_colors_array = explode("--",chunk_split(md5($name),6,"--"));

Nothing exciting. Might use it to generate little visual cues of authorship for aggregated views... somewhere.

Update:
You can get 10 three letter hex colors by changing the 6 to 3.

I only need 1 or 4 for my purposes.

Update 2:
$name_colors_array2 = str_split(md5("http://bopuc.levendis.com/feed/feed.xml"),6);
is shorter. ;)

Comments

And it works with Kanjis ;)

Posted by: カ−ル at September 17, 2006 09:29 AM