JavaScript converts RGB colors to hexadecimal colors by means of operators

From , 2 Years ago, written in JavaScript, viewed 174 times.
URL https://pastebin.vip/view/27b09e18
  1. function RGB2HEX(a,b,c){return"#"+((256+a<<8|b)<<8|c).toString(16).slice(1)}
  2. //或者
  3. function toHexString(r,g,b) {
  4.   return ("00000" + (r << 16 | g << 8 | b).toString(16)).slice(-6);
  5. }
  6. var hex = toHexString(red, green, blue);
  7. //javascript/5078

Reply to "JavaScript converts RGB colors to hexadecimal colors by means of operators"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website