not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
865 B

  1. var shadeColor = function shadeColor(color, percent) {
  2. var Red = parseInt(color.substring(1, 3), 16);
  3. var Green = parseInt(color.substring(3, 5), 16);
  4. var Blue = parseInt(color.substring(5, 7), 16);
  5. Red = parseInt(Red * (100 + percent) / 100, 10);
  6. Green = parseInt(Green * (100 + percent) / 100, 10);
  7. Blue = parseInt(Blue * (100 + percent) / 100, 10);
  8. Red = Red < 255 ? Red : 255;
  9. Green = Green < 255 ? Green : 255;
  10. Blue = Blue < 255 ? Blue : 255;
  11. var shadedRed = Red.toString(16).length === 1 ? "0" + Red.toString(16) : Red.toString(16);
  12. var shadedGreen = Green.toString(16).length === 1 ? "0" + Green.toString(16) : Green.toString(16);
  13. var shadedBlue = Blue.toString(16).length === 1 ? "0" + Blue.toString(16) : Blue.toString(16);
  14. return "#" + shadedRed + shadedGreen + shadedBlue;
  15. };
  16. define(function () {
  17. return shadeColor;
  18. });