From 68c7ab5fa1eba878c5b33998ad16651e8a7c528f Mon Sep 17 00:00:00 2001 From: prrashi Date: Sun, 10 Apr 2016 06:57:42 -0400 Subject: [PATCH] Removed color.js --- examples/color.js | 63 --------------------------------------------- examples/index.html | 20 -------------- 2 files changed, 83 deletions(-) delete mode 100644 examples/color.js diff --git a/examples/color.js b/examples/color.js deleted file mode 100644 index ad78525..0000000 --- a/examples/color.js +++ /dev/null @@ -1,63 +0,0 @@ -window.coolColor = {}; - -!(function(color){ - - function isDefined (value) { - - return value.toString() !== "undefined"; - } - - var hexRegex = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/, - rgbRegex = /^rgb\(([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})\)$/; - - var hexToRGB = color.hexToRGB = function (hex) { - - if (!hexRegex.test(hex)) { - - return null; - } - - var hexValues = hexRegex.exec(hex), - r = parseInt(hexValues[1], 16), - g = parseInt(hexValues[2], 16), - b = parseInt(hexValues[3], 16); - - return {r:r, g:g, b:b} - }; - - function getPick(startVal, endVal, pick) { - - var newVal = (endVal - startVal)*(pick/100); - - newVal = Math.round(startVal + newVal).toString(16); - - if (newVal.length === 1) { - - newVal = "0" + newVal; - } - - return newVal; - } - - function pickColor (startColor, endColor, pick) { - - if (!startColor || !endColor) { - - return null; - } - - pick = isDefined(pick)? pick : 0; - - startColor = hexToRGB(startColor); - endColor = hexToRGB(endColor); - - var r = getPick(startColor.r, endColor.r, pick), - b = getPick(startColor.b, endColor.b, pick), - g = getPick(startColor.g, endColor.g, pick); - - return "#" + r + g + b; - } - - color.pickColor = pickColor; - -}(coolColor)); diff --git a/examples/index.html b/examples/index.html index 0fccf40..0b54d8e 100644 --- a/examples/index.html +++ b/examples/index.html @@ -25,7 +25,6 @@
-