adam84 Posted May 5, 2011 Share Posted May 5, 2011 Hey, We have a software program, where a user can set the color of different tasks and stuff. When the save it, the value in the database is an int. How would I go about converting that into a hex value. Red: 255 Green: 33280 Grey: 13026246 Any ideas, thanks Link to comment https://forums.phpfreaks.com/topic/235621-php-and-colors/ Share on other sites More sharing options...
dragon_sa Posted May 5, 2011 Share Posted May 5, 2011 this article may help you http://www.anyexample.com/programming/php/php_convert_rgb_from_to_html_hex_color.xml Link to comment https://forums.phpfreaks.com/topic/235621-php-and-colors/#findComment-1211022 Share on other sites More sharing options...
adam84 Posted May 5, 2011 Author Share Posted May 5, 2011 Thank man, but its not working at all. The color is saved as a long from VB and I want to covert it using PHP Link to comment https://forums.phpfreaks.com/topic/235621-php-and-colors/#findComment-1211051 Share on other sites More sharing options...
The Little Guy Posted May 5, 2011 Share Posted May 5, 2011 Give this a try: http://phpsnips.com/snippet.php?id=59 Link to comment https://forums.phpfreaks.com/topic/235621-php-and-colors/#findComment-1211055 Share on other sites More sharing options...
PFMaBiSmAd Posted May 5, 2011 Share Posted May 5, 2011 Are you sure your first example isn't BLUE? // set $int equal to your integer values - $hex = sprintf("%06s",strtoupper(dechex($int))); echo $hex; Link to comment https://forums.phpfreaks.com/topic/235621-php-and-colors/#findComment-1211060 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.