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 Quote 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 Quote 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 Quote 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 Quote 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; Quote Link to comment https://forums.phpfreaks.com/topic/235621-php-and-colors/#findComment-1211060 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.