星空网 > 软件开发 > Java

js方法实现rgb颜色转换成16进制格式的代码的方法

原文地址:http://www.cnblogs.com/vaal-water/archive/2013/04/08/3008880.html

自己试过很好用

js方法实现rgb颜色转换成16进制格式的代码的方法
function zero_fill_hex(num, digits) { var s = num.toString(16); while (s.length < digits)  s = "0" + s; return s;}function rgb2hex(rgb) { if (rgb.charAt(0) == '#')  return rgb;  var ds = rgb.split(/\D+/); var decimal = Number(ds[1]) * 65536 + Number(ds[2]) * 256 + Number(ds[3]); return "#" + zero_fill_hex(decimal, 6);}





原标题:js方法实现rgb颜色转换成16进制格式的代码的方法

关键词:JS

JS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

N12H:https://www.ikjzd.com/w/4409
法国时尚平台Showroomprive:https://www.ikjzd.com/w/441
clergerieparis:https://www.ikjzd.com/w/4410
欧贝达(OBD Logistics):https://www.ikjzd.com/w/4411
OneSight营销云:https://www.ikjzd.com/w/4412
hisenhome:https://www.ikjzd.com/w/4413
长治婚庆女司仪和主持人:https://www.vstour.cn/a/366176.html
北京丰台区水上乐园哪家好玩?:https://www.vstour.cn/a/366177.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流