Convert RGB to HEX


/ Published in: PHP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. function rgb2hex($rgb){
  2. return sprintf("%06X", $rgb);
  3. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.