Posted By

scopefragger on 09/01/09


Tagged

hex convert RGB


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
scopefragger


Convert RGB to HEX


 / Published in: PHP
 

URL: http://www.scopesden.co.uk/code_get_feed.php?Content_ref=8

Ever needed to convert rgb to hex on your website, maybe you have a slider that handles rgb but your backend uses hex, this issue can be resolved easily be using the following code. Remember to keep in mind that php and html primarily uses hex colors.

  1. function rgb2hex($rgb){
  2. return sprintf("%06X", $rgb);
  3. }

Report this snippet  

You need to login to post a comment.