aboutsummaryrefslogtreecommitdiff
path: root/node_modules/clean-css/lib/optimizer/level-1/shorten-hsl.js
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:43:05 +0800
committerruki <waruqi@gmail.com>2018-11-07 22:18:30 +0800
commit89e95b3f143682ed9a006991bacf45c9dcba4818 (patch)
tree4f44cf41b828577d583890bdd5a1c31e8491a6ba /node_modules/clean-css/lib/optimizer/level-1/shorten-hsl.js
parentaa7f0199255277949790b41c56e8ec97dd4f0da4 (diff)
downloadxmake-docs-vuepress.tar.gz
xmake-docs-vuepress.zip
remove node_modulesvuepress
Diffstat (limited to 'node_modules/clean-css/lib/optimizer/level-1/shorten-hsl.js')
-rw-r--r--node_modules/clean-css/lib/optimizer/level-1/shorten-hsl.js61
1 files changed, 0 insertions, 61 deletions
diff --git a/node_modules/clean-css/lib/optimizer/level-1/shorten-hsl.js b/node_modules/clean-css/lib/optimizer/level-1/shorten-hsl.js
deleted file mode 100644
index fe98dfd3..00000000
--- a/node_modules/clean-css/lib/optimizer/level-1/shorten-hsl.js
+++ /dev/null
@@ -1,61 +0,0 @@
-// HSL to RGB converter. Both methods adapted from:
-// http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
-
-function hslToRgb(h, s, l) {
- var r, g, b;
-
- // normalize hue orientation b/w 0 and 360 degrees
- h = h % 360;
- if (h < 0)
- h += 360;
- h = ~~h / 360;
-
- if (s < 0)
- s = 0;
- else if (s > 100)
- s = 100;
- s = ~~s / 100;
-
- if (l < 0)
- l = 0;
- else if (l > 100)
- l = 100;
- l = ~~l / 100;
-
- if (s === 0) {
- r = g = b = l; // achromatic
- } else {
- var q = l < 0.5 ?
- l * (1 + s) :
- l + s - l * s;
- var p = 2 * l - q;
- r = hueToRgb(p, q, h + 1/3);
- g = hueToRgb(p, q, h);
- b = hueToRgb(p, q, h - 1/3);
- }
-
- return [~~(r * 255), ~~(g * 255), ~~(b * 255)];
-}
-
-function hueToRgb(p, q, t) {
- if (t < 0) t += 1;
- if (t > 1) t -= 1;
- if (t < 1/6) return p + (q - p) * 6 * t;
- if (t < 1/2) return q;
- if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
- return p;
-}
-
-function shortenHsl(hue, saturation, lightness) {
- var asRgb = hslToRgb(hue, saturation, lightness);
- var redAsHex = asRgb[0].toString(16);
- var greenAsHex = asRgb[1].toString(16);
- var blueAsHex = asRgb[2].toString(16);
-
- return '#' +
- ((redAsHex.length == 1 ? '0' : '') + redAsHex) +
- ((greenAsHex.length == 1 ? '0' : '') + greenAsHex) +
- ((blueAsHex.length == 1 ? '0' : '') + blueAsHex);
-}
-
-module.exports = shortenHsl;