Loading ...
Sorry, an error occurred while loading the content.

sorry about that lame color tint function: here is getTintedColor final enjoy!

Expand Messages
  • hans
    // function getTintedColor - Send in a color (in #f4f4f4 or f4f4f4 format) and a v value +- 0-255 // this v value works on the r,g,b eg v =-10 so r -10 g -10 b
    Message 1 of 1 , May 4 2:34 AM
    • 0 Attachment
      // function getTintedColor - Send in a color (in #f4f4f4 or f4f4f4
      format) and a v value +- 0-255
      // this v value works on the r,g,b eg v =-10 so r -10 g -10 b -10
      returns value in #ff00ff format
      // richard maloney 2006 for engineX
      function getTintedColor(color, v) {
      if (color.length >6) { color=color.split("").shift().join())
      var rgb = parseInt(color, 16); var r = ((rgb >> 16) & 0xFF)+v;
      var g = ((rgb >> 8) & 0xFF)+v; var b = (rgb & 0xFF)+v;
      r = (r < 0 || isNaN(r)) ? 0 : ((r > 255) ? 255 : r);
      g = (g < 0 || isNaN(g)) ? 0 : ((g > 255) ? 255 : g);
      b = (b < 0 || isNaN(b)) ? 0 : ((b > 255) ? 255 : b);
      r = r.toString(16); if (r.length == 1) r = '0' + r;
      g = g.toString(16); if (g.length == 1) g = '0' + g;
      b = b.toString(16); if (b.length == 1) b = '0' + b;
      return "#" + r + g + b;
      }
    Your message has been successfully submitted and would be delivered to recipients shortly.