Up-to-the Minute PHP News, views and community en-us Wed, 16 Apr 2014 02:16:27 -0500 30 <![CDATA[ Convert RGB from/to HTML hex color]]> On, there's a quick little tutorial demonstrating how to convert an RGB value passed into a function into the corresponding HTML hex color.

There are actually two functions - one for hex to rgb and the other for rgb to hex (though it's not a far leap to make a wrapper function that handles the value correctly by detecting the format - a string or array). They give the code for both of the functions and a bit of sample code for the PHP it could be embedded in.

The only real place I can think of using something like this is in a web-based graphics application - maybe for color-matching or something. More often than not, though, simple software like Huey for Windows can provide you the same information (and more).

Any other applications you all can think of?

Thu, 16 Nov 2006 07:47:00 -0600