a zip code crypto-currency system good for red ONLY

shorten-rgb.js 450B

1234567891011
  1. function shortenRgb(red, green, blue) {
  2. var normalizedRed = Math.max(0, Math.min(parseInt(red), 255));
  3. var normalizedGreen = Math.max(0, Math.min(parseInt(green), 255));
  4. var normalizedBlue = Math.max(0, Math.min(parseInt(blue), 255));
  5. // Credit: Asen http://jsbin.com/UPUmaGOc/2/edit?js,console
  6. return '#' + ('00000' + (normalizedRed << 16 | normalizedGreen << 8 | normalizedBlue).toString(16)).slice(-6);
  7. }
  8. module.exports = shortenRgb;