uapte
This commit is contained in:
21
node_modules/color/LICENSE
generated
vendored
Normal file
21
node_modules/color/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
Copyright (c) 2012 Heather Arthur
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
124
node_modules/color/README.md
generated
vendored
Normal file
124
node_modules/color/README.md
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
# color [](https://travis-ci.org/Qix-/color)
|
||||
|
||||
> JavaScript library for color conversion and manipulation with support for CSS color strings.
|
||||
|
||||
```js
|
||||
var color = Color("#7743CE");
|
||||
|
||||
color.alpha(0.5).lighten(0.5);
|
||||
|
||||
console.log(color.hslString()); // "hsla(262, 59%, 81%, 0.5)"
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ npm install color
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var Color = require("color")
|
||||
```
|
||||
|
||||
### Setters
|
||||
|
||||
```js
|
||||
var color = Color("rgb(255, 255, 255)")
|
||||
var color = Color({r: 255, g: 255, b: 255})
|
||||
var color = Color().rgb(255, 255, 255)
|
||||
var color = Color().rgb([255, 255, 255])
|
||||
```
|
||||
Pass any valid CSS color string into `Color()` or a hash of values. Also load in color values with `rgb()`, `hsl()`, `hsv()`, `hwb()`, and `cmyk()`.
|
||||
|
||||
```js
|
||||
color.red(120)
|
||||
```
|
||||
Set the values for individual channels with `alpha`, `red`, `green`, `blue`, `hue`, `saturation` (hsl), `saturationv` (hsv), `lightness`, `whiteness`, `blackness`, `cyan`, `magenta`, `yellow`, `black`
|
||||
|
||||
### Getters
|
||||
|
||||
|
||||
```js
|
||||
color.rgb() // {r: 255, g: 255, b: 255}
|
||||
```
|
||||
Get a hash of the rgb values with `rgb()`, similarly for `hsl()`, `hsv()`, and `cmyk()`
|
||||
|
||||
```js
|
||||
color.rgbArray() // [255, 255, 255]
|
||||
```
|
||||
Get an array of the values with `rgbArray()`, `hslArray()`, `hsvArray()`, and `cmykArray()`.
|
||||
|
||||
```js
|
||||
color.red() // 255
|
||||
```
|
||||
Get the value for an individual channel.
|
||||
|
||||
### CSS Strings
|
||||
|
||||
```js
|
||||
color.hslString() // "hsl(320, 50%, 100%)"
|
||||
```
|
||||
|
||||
Different CSS String formats for the color are on `hexString`, `rgbString`, `percentString`, `hslString`, `hwbString`, and `keyword` (undefined if it's not a keyword color). `"rgba"` and `"hsla"` are used if the current alpha value of the color isn't `1`.
|
||||
|
||||
### Luminosity
|
||||
|
||||
```js
|
||||
color.luminosity(); // 0.412
|
||||
```
|
||||
The [WCAG luminosity](http://www.w3.org/TR/WCAG20/#relativeluminancedef) of the color. 0 is black, 1 is white.
|
||||
|
||||
```js
|
||||
color.contrast(Color("blue")) // 12
|
||||
```
|
||||
The [WCAG contrast ratio](http://www.w3.org/TR/WCAG20/#contrast-ratiodef) to another color, from 1 (same color) to 21 (contrast b/w white and black).
|
||||
|
||||
```js
|
||||
color.light(); // true
|
||||
color.dark(); // false
|
||||
```
|
||||
Get whether the color is "light" or "dark", useful for deciding text color.
|
||||
|
||||
### Manipulation
|
||||
|
||||
```js
|
||||
color.negate() // rgb(0, 100, 255) -> rgb(255, 155, 0)
|
||||
|
||||
color.lighten(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 75%)
|
||||
color.darken(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 25%)
|
||||
|
||||
color.saturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 75%, 50%)
|
||||
color.desaturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 25%, 50%)
|
||||
color.greyscale() // #5CBF54 -> #969696
|
||||
|
||||
color.whiten(0.5) // hwb(100, 50%, 50%) -> hwb(100, 75%, 50%)
|
||||
color.blacken(0.5) // hwb(100, 50%, 50%) -> hwb(100, 50%, 75%)
|
||||
|
||||
color.clearer(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 0.4)
|
||||
color.opaquer(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 1.0)
|
||||
|
||||
color.rotate(180) // hsl(60, 20%, 20%) -> hsl(240, 20%, 20%)
|
||||
color.rotate(-90) // hsl(60, 20%, 20%) -> hsl(330, 20%, 20%)
|
||||
|
||||
color.mix(Color("yellow")) // cyan -> rgb(128, 255, 128)
|
||||
color.mix(Color("yellow"), 0.3) // cyan -> rgb(77, 255, 179)
|
||||
|
||||
// chaining
|
||||
color.green(100).greyscale().lighten(0.6)
|
||||
```
|
||||
|
||||
### Clone
|
||||
|
||||
You can can create a copy of an existing color object using `clone()`:
|
||||
|
||||
```js
|
||||
color.clone() // -> New color object
|
||||
```
|
||||
|
||||
And more to come...
|
||||
|
||||
## Propers
|
||||
|
||||
The API was inspired by [color-js](https://github.com/brehaut/color-js). Manipulation functions by CSS tools like Sass, LESS, and Stylus.
|
||||
459
node_modules/color/index.js
generated
vendored
Normal file
459
node_modules/color/index.js
generated
vendored
Normal file
@@ -0,0 +1,459 @@
|
||||
/* MIT license */
|
||||
var clone = require('clone');
|
||||
var convert = require('color-convert');
|
||||
var string = require('color-string');
|
||||
|
||||
var Color = function (obj) {
|
||||
if (obj instanceof Color) {
|
||||
return obj;
|
||||
}
|
||||
if (!(this instanceof Color)) {
|
||||
return new Color(obj);
|
||||
}
|
||||
|
||||
this.values = {
|
||||
rgb: [0, 0, 0],
|
||||
hsl: [0, 0, 0],
|
||||
hsv: [0, 0, 0],
|
||||
hwb: [0, 0, 0],
|
||||
cmyk: [0, 0, 0, 0],
|
||||
alpha: 1
|
||||
};
|
||||
|
||||
// parse Color() argument
|
||||
var vals;
|
||||
if (typeof obj === 'string') {
|
||||
vals = string.getRgba(obj);
|
||||
if (vals) {
|
||||
this.setValues('rgb', vals);
|
||||
} else if (vals = string.getHsla(obj)) {
|
||||
this.setValues('hsl', vals);
|
||||
} else if (vals = string.getHwb(obj)) {
|
||||
this.setValues('hwb', vals);
|
||||
} else {
|
||||
throw new Error('Unable to parse color from string "' + obj + '"');
|
||||
}
|
||||
} else if (typeof obj === 'object') {
|
||||
vals = obj;
|
||||
if (vals.r !== undefined || vals.red !== undefined) {
|
||||
this.setValues('rgb', vals);
|
||||
} else if (vals.l !== undefined || vals.lightness !== undefined) {
|
||||
this.setValues('hsl', vals);
|
||||
} else if (vals.v !== undefined || vals.value !== undefined) {
|
||||
this.setValues('hsv', vals);
|
||||
} else if (vals.w !== undefined || vals.whiteness !== undefined) {
|
||||
this.setValues('hwb', vals);
|
||||
} else if (vals.c !== undefined || vals.cyan !== undefined) {
|
||||
this.setValues('cmyk', vals);
|
||||
} else {
|
||||
throw new Error('Unable to parse color from object ' + JSON.stringify(obj));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Color.prototype = {
|
||||
rgb: function () {
|
||||
return this.setSpace('rgb', arguments);
|
||||
},
|
||||
hsl: function () {
|
||||
return this.setSpace('hsl', arguments);
|
||||
},
|
||||
hsv: function () {
|
||||
return this.setSpace('hsv', arguments);
|
||||
},
|
||||
hwb: function () {
|
||||
return this.setSpace('hwb', arguments);
|
||||
},
|
||||
cmyk: function () {
|
||||
return this.setSpace('cmyk', arguments);
|
||||
},
|
||||
|
||||
rgbArray: function () {
|
||||
return this.values.rgb;
|
||||
},
|
||||
hslArray: function () {
|
||||
return this.values.hsl;
|
||||
},
|
||||
hsvArray: function () {
|
||||
return this.values.hsv;
|
||||
},
|
||||
hwbArray: function () {
|
||||
if (this.values.alpha !== 1) {
|
||||
return this.values.hwb.concat([this.values.alpha]);
|
||||
}
|
||||
return this.values.hwb;
|
||||
},
|
||||
cmykArray: function () {
|
||||
return this.values.cmyk;
|
||||
},
|
||||
rgbaArray: function () {
|
||||
var rgb = this.values.rgb;
|
||||
return rgb.concat([this.values.alpha]);
|
||||
},
|
||||
rgbaArrayNormalized: function () {
|
||||
var rgb = this.values.rgb;
|
||||
var glRgba = [];
|
||||
for (var i = 0; i < 3; i++) {
|
||||
glRgba[i] = rgb[i] / 255;
|
||||
}
|
||||
glRgba.push(this.values.alpha);
|
||||
return glRgba;
|
||||
},
|
||||
hslaArray: function () {
|
||||
var hsl = this.values.hsl;
|
||||
return hsl.concat([this.values.alpha]);
|
||||
},
|
||||
alpha: function (val) {
|
||||
if (val === undefined) {
|
||||
return this.values.alpha;
|
||||
}
|
||||
this.setValues('alpha', val);
|
||||
return this;
|
||||
},
|
||||
|
||||
red: function (val) {
|
||||
return this.setChannel('rgb', 0, val);
|
||||
},
|
||||
green: function (val) {
|
||||
return this.setChannel('rgb', 1, val);
|
||||
},
|
||||
blue: function (val) {
|
||||
return this.setChannel('rgb', 2, val);
|
||||
},
|
||||
hue: function (val) {
|
||||
if (val) {
|
||||
val %= 360;
|
||||
val = val < 0 ? 360 + val : val;
|
||||
}
|
||||
return this.setChannel('hsl', 0, val);
|
||||
},
|
||||
saturation: function (val) {
|
||||
return this.setChannel('hsl', 1, val);
|
||||
},
|
||||
lightness: function (val) {
|
||||
return this.setChannel('hsl', 2, val);
|
||||
},
|
||||
saturationv: function (val) {
|
||||
return this.setChannel('hsv', 1, val);
|
||||
},
|
||||
whiteness: function (val) {
|
||||
return this.setChannel('hwb', 1, val);
|
||||
},
|
||||
blackness: function (val) {
|
||||
return this.setChannel('hwb', 2, val);
|
||||
},
|
||||
value: function (val) {
|
||||
return this.setChannel('hsv', 2, val);
|
||||
},
|
||||
cyan: function (val) {
|
||||
return this.setChannel('cmyk', 0, val);
|
||||
},
|
||||
magenta: function (val) {
|
||||
return this.setChannel('cmyk', 1, val);
|
||||
},
|
||||
yellow: function (val) {
|
||||
return this.setChannel('cmyk', 2, val);
|
||||
},
|
||||
black: function (val) {
|
||||
return this.setChannel('cmyk', 3, val);
|
||||
},
|
||||
|
||||
hexString: function () {
|
||||
return string.hexString(this.values.rgb);
|
||||
},
|
||||
rgbString: function () {
|
||||
return string.rgbString(this.values.rgb, this.values.alpha);
|
||||
},
|
||||
rgbaString: function () {
|
||||
return string.rgbaString(this.values.rgb, this.values.alpha);
|
||||
},
|
||||
percentString: function () {
|
||||
return string.percentString(this.values.rgb, this.values.alpha);
|
||||
},
|
||||
hslString: function () {
|
||||
return string.hslString(this.values.hsl, this.values.alpha);
|
||||
},
|
||||
hslaString: function () {
|
||||
return string.hslaString(this.values.hsl, this.values.alpha);
|
||||
},
|
||||
hwbString: function () {
|
||||
return string.hwbString(this.values.hwb, this.values.alpha);
|
||||
},
|
||||
keyword: function () {
|
||||
return string.keyword(this.values.rgb, this.values.alpha);
|
||||
},
|
||||
|
||||
rgbNumber: function () {
|
||||
return (this.values.rgb[0] << 16) | (this.values.rgb[1] << 8) | this.values.rgb[2];
|
||||
},
|
||||
|
||||
luminosity: function () {
|
||||
// http://www.w3.org/TR/WCAG20/#relativeluminancedef
|
||||
var rgb = this.values.rgb;
|
||||
var lum = [];
|
||||
for (var i = 0; i < rgb.length; i++) {
|
||||
var chan = rgb[i] / 255;
|
||||
lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
|
||||
}
|
||||
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
|
||||
},
|
||||
|
||||
contrast: function (color2) {
|
||||
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
|
||||
var lum1 = this.luminosity();
|
||||
var lum2 = color2.luminosity();
|
||||
if (lum1 > lum2) {
|
||||
return (lum1 + 0.05) / (lum2 + 0.05);
|
||||
}
|
||||
return (lum2 + 0.05) / (lum1 + 0.05);
|
||||
},
|
||||
|
||||
level: function (color2) {
|
||||
var contrastRatio = this.contrast(color2);
|
||||
if (contrastRatio >= 7.1) {
|
||||
return 'AAA';
|
||||
}
|
||||
|
||||
return (contrastRatio >= 4.5) ? 'AA' : '';
|
||||
},
|
||||
|
||||
dark: function () {
|
||||
// YIQ equation from http://24ways.org/2010/calculating-color-contrast
|
||||
var rgb = this.values.rgb;
|
||||
var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
|
||||
return yiq < 128;
|
||||
},
|
||||
|
||||
light: function () {
|
||||
return !this.dark();
|
||||
},
|
||||
|
||||
negate: function () {
|
||||
var rgb = [];
|
||||
for (var i = 0; i < 3; i++) {
|
||||
rgb[i] = 255 - this.values.rgb[i];
|
||||
}
|
||||
this.setValues('rgb', rgb);
|
||||
return this;
|
||||
},
|
||||
|
||||
lighten: function (ratio) {
|
||||
this.values.hsl[2] += this.values.hsl[2] * ratio;
|
||||
this.setValues('hsl', this.values.hsl);
|
||||
return this;
|
||||
},
|
||||
|
||||
darken: function (ratio) {
|
||||
this.values.hsl[2] -= this.values.hsl[2] * ratio;
|
||||
this.setValues('hsl', this.values.hsl);
|
||||
return this;
|
||||
},
|
||||
|
||||
saturate: function (ratio) {
|
||||
this.values.hsl[1] += this.values.hsl[1] * ratio;
|
||||
this.setValues('hsl', this.values.hsl);
|
||||
return this;
|
||||
},
|
||||
|
||||
desaturate: function (ratio) {
|
||||
this.values.hsl[1] -= this.values.hsl[1] * ratio;
|
||||
this.setValues('hsl', this.values.hsl);
|
||||
return this;
|
||||
},
|
||||
|
||||
whiten: function (ratio) {
|
||||
this.values.hwb[1] += this.values.hwb[1] * ratio;
|
||||
this.setValues('hwb', this.values.hwb);
|
||||
return this;
|
||||
},
|
||||
|
||||
blacken: function (ratio) {
|
||||
this.values.hwb[2] += this.values.hwb[2] * ratio;
|
||||
this.setValues('hwb', this.values.hwb);
|
||||
return this;
|
||||
},
|
||||
|
||||
greyscale: function () {
|
||||
var rgb = this.values.rgb;
|
||||
// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
|
||||
var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
|
||||
this.setValues('rgb', [val, val, val]);
|
||||
return this;
|
||||
},
|
||||
|
||||
clearer: function (ratio) {
|
||||
this.setValues('alpha', this.values.alpha - (this.values.alpha * ratio));
|
||||
return this;
|
||||
},
|
||||
|
||||
opaquer: function (ratio) {
|
||||
this.setValues('alpha', this.values.alpha + (this.values.alpha * ratio));
|
||||
return this;
|
||||
},
|
||||
|
||||
rotate: function (degrees) {
|
||||
var hue = this.values.hsl[0];
|
||||
hue = (hue + degrees) % 360;
|
||||
hue = hue < 0 ? 360 + hue : hue;
|
||||
this.values.hsl[0] = hue;
|
||||
this.setValues('hsl', this.values.hsl);
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Ported from sass implementation in C
|
||||
* https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
|
||||
*/
|
||||
mix: function (mixinColor, weight) {
|
||||
var color1 = this;
|
||||
var color2 = mixinColor;
|
||||
var p = weight === undefined ? 0.5 : weight;
|
||||
|
||||
var w = 2 * p - 1;
|
||||
var a = color1.alpha() - color2.alpha();
|
||||
|
||||
var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
|
||||
var w2 = 1 - w1;
|
||||
|
||||
return this
|
||||
.rgb(
|
||||
w1 * color1.red() + w2 * color2.red(),
|
||||
w1 * color1.green() + w2 * color2.green(),
|
||||
w1 * color1.blue() + w2 * color2.blue()
|
||||
)
|
||||
.alpha(color1.alpha() * p + color2.alpha() * (1 - p));
|
||||
},
|
||||
|
||||
toJSON: function () {
|
||||
return this.rgb();
|
||||
},
|
||||
|
||||
clone: function () {
|
||||
var col = new Color();
|
||||
col.values = clone(this.values);
|
||||
return col;
|
||||
}
|
||||
};
|
||||
|
||||
Color.prototype.getValues = function (space) {
|
||||
var vals = {};
|
||||
|
||||
for (var i = 0; i < space.length; i++) {
|
||||
vals[space.charAt(i)] = this.values[space][i];
|
||||
}
|
||||
|
||||
if (this.values.alpha !== 1) {
|
||||
vals.a = this.values.alpha;
|
||||
}
|
||||
|
||||
// {r: 255, g: 255, b: 255, a: 0.4}
|
||||
return vals;
|
||||
};
|
||||
|
||||
Color.prototype.setValues = function (space, vals) {
|
||||
var spaces = {
|
||||
rgb: ['red', 'green', 'blue'],
|
||||
hsl: ['hue', 'saturation', 'lightness'],
|
||||
hsv: ['hue', 'saturation', 'value'],
|
||||
hwb: ['hue', 'whiteness', 'blackness'],
|
||||
cmyk: ['cyan', 'magenta', 'yellow', 'black']
|
||||
};
|
||||
|
||||
var maxes = {
|
||||
rgb: [255, 255, 255],
|
||||
hsl: [360, 100, 100],
|
||||
hsv: [360, 100, 100],
|
||||
hwb: [360, 100, 100],
|
||||
cmyk: [100, 100, 100, 100]
|
||||
};
|
||||
|
||||
var i;
|
||||
var alpha = 1;
|
||||
if (space === 'alpha') {
|
||||
alpha = vals;
|
||||
} else if (vals.length) {
|
||||
// [10, 10, 10]
|
||||
this.values[space] = vals.slice(0, space.length);
|
||||
alpha = vals[space.length];
|
||||
} else if (vals[space.charAt(0)] !== undefined) {
|
||||
// {r: 10, g: 10, b: 10}
|
||||
for (i = 0; i < space.length; i++) {
|
||||
this.values[space][i] = vals[space.charAt(i)];
|
||||
}
|
||||
|
||||
alpha = vals.a;
|
||||
} else if (vals[spaces[space][0]] !== undefined) {
|
||||
// {red: 10, green: 10, blue: 10}
|
||||
var chans = spaces[space];
|
||||
|
||||
for (i = 0; i < space.length; i++) {
|
||||
this.values[space][i] = vals[chans[i]];
|
||||
}
|
||||
|
||||
alpha = vals.alpha;
|
||||
}
|
||||
|
||||
this.values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? this.values.alpha : alpha)));
|
||||
|
||||
if (space === 'alpha') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var capped;
|
||||
|
||||
// cap values of the space prior converting all values
|
||||
for (i = 0; i < space.length; i++) {
|
||||
capped = Math.max(0, Math.min(maxes[space][i], this.values[space][i]));
|
||||
this.values[space][i] = Math.round(capped);
|
||||
}
|
||||
|
||||
// convert to all the other color spaces
|
||||
for (var sname in spaces) {
|
||||
if (sname !== space) {
|
||||
this.values[sname] = convert[space][sname](this.values[space]);
|
||||
}
|
||||
|
||||
// cap values
|
||||
for (i = 0; i < sname.length; i++) {
|
||||
capped = Math.max(0, Math.min(maxes[sname][i], this.values[sname][i]));
|
||||
this.values[sname][i] = Math.round(capped);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
Color.prototype.setSpace = function (space, args) {
|
||||
var vals = args[0];
|
||||
|
||||
if (vals === undefined) {
|
||||
// color.rgb()
|
||||
return this.getValues(space);
|
||||
}
|
||||
|
||||
// color.rgb(10, 10, 10)
|
||||
if (typeof vals === 'number') {
|
||||
vals = Array.prototype.slice.call(args);
|
||||
}
|
||||
|
||||
this.setValues(space, vals);
|
||||
return this;
|
||||
};
|
||||
|
||||
Color.prototype.setChannel = function (space, index, val) {
|
||||
if (val === undefined) {
|
||||
// color.red()
|
||||
return this.values[space][index];
|
||||
} else if (val === this.values[space][index]) {
|
||||
// color.red(color.red())
|
||||
return this;
|
||||
}
|
||||
|
||||
// color.red(100)
|
||||
this.values[space][index] = val;
|
||||
this.setValues(space, this.values[space]);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = Color;
|
||||
4
node_modules/color/node_modules/clone/.npmignore
generated
vendored
Normal file
4
node_modules/color/node_modules/clone/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/node_modules/
|
||||
/test.js
|
||||
/*.html
|
||||
/.travis.yml
|
||||
18
node_modules/color/node_modules/clone/LICENSE
generated
vendored
Normal file
18
node_modules/color/node_modules/clone/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
Copyright © 2011-2015 Paul Vorbach <paul@vorba.ch>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the “Software”), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
126
node_modules/color/node_modules/clone/README.md
generated
vendored
Normal file
126
node_modules/color/node_modules/clone/README.md
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
# clone
|
||||
|
||||
[](http://travis-ci.org/pvorb/node-clone)
|
||||
|
||||
[](http://npm-stat.com/charts.html?package=clone)
|
||||
|
||||
offers foolproof _deep cloning_ of objects, arrays, numbers, strings etc. in JavaScript.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
npm install clone
|
||||
|
||||
(It also works with browserify, ender or standalone.)
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
~~~ javascript
|
||||
var clone = require('clone');
|
||||
|
||||
var a, b;
|
||||
|
||||
a = { foo: { bar: 'baz' } }; // initial value of a
|
||||
|
||||
b = clone(a); // clone a -> b
|
||||
a.foo.bar = 'foo'; // change a
|
||||
|
||||
console.log(a); // show a
|
||||
console.log(b); // show b
|
||||
~~~
|
||||
|
||||
This will print:
|
||||
|
||||
~~~ javascript
|
||||
{ foo: { bar: 'foo' } }
|
||||
{ foo: { bar: 'baz' } }
|
||||
~~~
|
||||
|
||||
**clone** masters cloning simple objects (even with custom prototype), arrays,
|
||||
Date objects, and RegExp objects. Everything is cloned recursively, so that you
|
||||
can clone dates in arrays in objects, for example.
|
||||
|
||||
|
||||
## API
|
||||
|
||||
`clone(val, circular, depth)`
|
||||
|
||||
* `val` -- the value that you want to clone, any type allowed
|
||||
* `circular` -- boolean
|
||||
|
||||
Call `clone` with `circular` set to `false` if you are certain that `obj`
|
||||
contains no circular references. This will give better performance if needed.
|
||||
There is no error if `undefined` or `null` is passed as `obj`.
|
||||
* `depth` -- depth to which the object is to be cloned (optional,
|
||||
defaults to infinity)
|
||||
|
||||
`clone.clonePrototype(obj)`
|
||||
|
||||
* `obj` -- the object that you want to clone
|
||||
|
||||
Does a prototype clone as
|
||||
[described by Oran Looney](http://oranlooney.com/functional-javascript/).
|
||||
|
||||
|
||||
## Circular References
|
||||
|
||||
~~~ javascript
|
||||
var a, b;
|
||||
|
||||
a = { hello: 'world' };
|
||||
|
||||
a.myself = a;
|
||||
b = clone(a);
|
||||
|
||||
console.log(b);
|
||||
~~~
|
||||
|
||||
This will print:
|
||||
|
||||
~~~ javascript
|
||||
{ hello: "world", myself: [Circular] }
|
||||
~~~
|
||||
|
||||
So, `b.myself` points to `b`, not `a`. Neat!
|
||||
|
||||
|
||||
## Test
|
||||
|
||||
npm test
|
||||
|
||||
|
||||
## Caveat
|
||||
|
||||
Some special objects like a socket or `process.stdout`/`stderr` are known to not
|
||||
be cloneable. If you find other objects that cannot be cloned, please [open an
|
||||
issue](https://github.com/pvorb/node-clone/issues/new).
|
||||
|
||||
|
||||
## Bugs and Issues
|
||||
|
||||
If you encounter any bugs or issues, feel free to [open an issue at
|
||||
github](https://github.com/pvorb/node-clone/issues) or send me an email to
|
||||
<paul@vorba.ch>. I also always like to hear from you, if you’re using my code.
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2011-2015 [Paul Vorbach](http://paul.vorba.ch/) and
|
||||
[contributors](https://github.com/pvorb/node-clone/graphs/contributors).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the “Software”), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
10
node_modules/color/node_modules/clone/clone.iml
generated
vendored
Normal file
10
node_modules/color/node_modules/clone/clone.iml
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="clone node_modules" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
166
node_modules/color/node_modules/clone/clone.js
generated
vendored
Normal file
166
node_modules/color/node_modules/clone/clone.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
var clone = (function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Clones (copies) an Object using deep copying.
|
||||
*
|
||||
* This function supports circular references by default, but if you are certain
|
||||
* there are no circular references in your object, you can save some CPU time
|
||||
* by calling clone(obj, false).
|
||||
*
|
||||
* Caution: if `circular` is false and `parent` contains circular references,
|
||||
* your program may enter an infinite loop and crash.
|
||||
*
|
||||
* @param `parent` - the object to be cloned
|
||||
* @param `circular` - set to true if the object to be cloned may contain
|
||||
* circular references. (optional - true by default)
|
||||
* @param `depth` - set to a number if the object is only to be cloned to
|
||||
* a particular depth. (optional - defaults to Infinity)
|
||||
* @param `prototype` - sets the prototype to be used when cloning an object.
|
||||
* (optional - defaults to parent prototype).
|
||||
*/
|
||||
function clone(parent, circular, depth, prototype) {
|
||||
var filter;
|
||||
if (typeof circular === 'object') {
|
||||
depth = circular.depth;
|
||||
prototype = circular.prototype;
|
||||
filter = circular.filter;
|
||||
circular = circular.circular
|
||||
}
|
||||
// maintain two arrays for circular references, where corresponding parents
|
||||
// and children have the same index
|
||||
var allParents = [];
|
||||
var allChildren = [];
|
||||
|
||||
var useBuffer = typeof Buffer != 'undefined';
|
||||
|
||||
if (typeof circular == 'undefined')
|
||||
circular = true;
|
||||
|
||||
if (typeof depth == 'undefined')
|
||||
depth = Infinity;
|
||||
|
||||
// recurse this function so we don't reset allParents and allChildren
|
||||
function _clone(parent, depth) {
|
||||
// cloning null always returns null
|
||||
if (parent === null)
|
||||
return null;
|
||||
|
||||
if (depth == 0)
|
||||
return parent;
|
||||
|
||||
var child;
|
||||
var proto;
|
||||
if (typeof parent != 'object') {
|
||||
return parent;
|
||||
}
|
||||
|
||||
if (clone.__isArray(parent)) {
|
||||
child = [];
|
||||
} else if (clone.__isRegExp(parent)) {
|
||||
child = new RegExp(parent.source, __getRegExpFlags(parent));
|
||||
if (parent.lastIndex) child.lastIndex = parent.lastIndex;
|
||||
} else if (clone.__isDate(parent)) {
|
||||
child = new Date(parent.getTime());
|
||||
} else if (useBuffer && Buffer.isBuffer(parent)) {
|
||||
if (Buffer.allocUnsafe) {
|
||||
// Node.js >= 4.5.0
|
||||
child = Buffer.allocUnsafe(parent.length);
|
||||
} else {
|
||||
// Older Node.js versions
|
||||
child = new Buffer(parent.length);
|
||||
}
|
||||
parent.copy(child);
|
||||
return child;
|
||||
} else {
|
||||
if (typeof prototype == 'undefined') {
|
||||
proto = Object.getPrototypeOf(parent);
|
||||
child = Object.create(proto);
|
||||
}
|
||||
else {
|
||||
child = Object.create(prototype);
|
||||
proto = prototype;
|
||||
}
|
||||
}
|
||||
|
||||
if (circular) {
|
||||
var index = allParents.indexOf(parent);
|
||||
|
||||
if (index != -1) {
|
||||
return allChildren[index];
|
||||
}
|
||||
allParents.push(parent);
|
||||
allChildren.push(child);
|
||||
}
|
||||
|
||||
for (var i in parent) {
|
||||
var attrs;
|
||||
if (proto) {
|
||||
attrs = Object.getOwnPropertyDescriptor(proto, i);
|
||||
}
|
||||
|
||||
if (attrs && attrs.set == null) {
|
||||
continue;
|
||||
}
|
||||
child[i] = _clone(parent[i], depth - 1);
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
return _clone(parent, depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple flat clone using prototype, accepts only objects, usefull for property
|
||||
* override on FLAT configuration object (no nested props).
|
||||
*
|
||||
* USE WITH CAUTION! This may not behave as you wish if you do not know how this
|
||||
* works.
|
||||
*/
|
||||
clone.clonePrototype = function clonePrototype(parent) {
|
||||
if (parent === null)
|
||||
return null;
|
||||
|
||||
var c = function () {};
|
||||
c.prototype = parent;
|
||||
return new c();
|
||||
};
|
||||
|
||||
// private utility functions
|
||||
|
||||
function __objToStr(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
};
|
||||
clone.__objToStr = __objToStr;
|
||||
|
||||
function __isDate(o) {
|
||||
return typeof o === 'object' && __objToStr(o) === '[object Date]';
|
||||
};
|
||||
clone.__isDate = __isDate;
|
||||
|
||||
function __isArray(o) {
|
||||
return typeof o === 'object' && __objToStr(o) === '[object Array]';
|
||||
};
|
||||
clone.__isArray = __isArray;
|
||||
|
||||
function __isRegExp(o) {
|
||||
return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
|
||||
};
|
||||
clone.__isRegExp = __isRegExp;
|
||||
|
||||
function __getRegExpFlags(re) {
|
||||
var flags = '';
|
||||
if (re.global) flags += 'g';
|
||||
if (re.ignoreCase) flags += 'i';
|
||||
if (re.multiline) flags += 'm';
|
||||
return flags;
|
||||
};
|
||||
clone.__getRegExpFlags = __getRegExpFlags;
|
||||
|
||||
return clone;
|
||||
})();
|
||||
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = clone;
|
||||
}
|
||||
137
node_modules/color/node_modules/clone/package.json
generated
vendored
Normal file
137
node_modules/color/node_modules/clone/package.json
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
{
|
||||
"_from": "clone@^1.0.2",
|
||||
"_id": "clone@1.0.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
|
||||
"_location": "/color/clone",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "clone@^1.0.2",
|
||||
"name": "clone",
|
||||
"escapedName": "clone",
|
||||
"rawSpec": "^1.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/color"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
||||
"_shasum": "da309cc263df15994c688ca902179ca3c7cd7c7e",
|
||||
"_spec": "clone@^1.0.2",
|
||||
"_where": "/Applications/XAMPP/xamppfiles/htdocs/wordpress/t-latehome/wp-content/plugins/opal-estate-pro/node_modules/color",
|
||||
"author": {
|
||||
"name": "Paul Vorbach",
|
||||
"email": "paul@vorba.ch",
|
||||
"url": "http://paul.vorba.ch/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/pvorb/node-clone/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Blake Miner",
|
||||
"email": "miner.blake@gmail.com",
|
||||
"url": "http://www.blakeminer.com/"
|
||||
},
|
||||
{
|
||||
"name": "Tian You",
|
||||
"email": "axqd001@gmail.com",
|
||||
"url": "http://blog.axqd.net/"
|
||||
},
|
||||
{
|
||||
"name": "George Stagas",
|
||||
"email": "gstagas@gmail.com",
|
||||
"url": "http://stagas.com/"
|
||||
},
|
||||
{
|
||||
"name": "Tobiasz Cudnik",
|
||||
"email": "tobiasz.cudnik@gmail.com",
|
||||
"url": "https://github.com/TobiaszCudnik"
|
||||
},
|
||||
{
|
||||
"name": "Pavel Lang",
|
||||
"email": "langpavel@phpskelet.org",
|
||||
"url": "https://github.com/langpavel"
|
||||
},
|
||||
{
|
||||
"name": "Dan MacTough",
|
||||
"url": "http://yabfog.com/"
|
||||
},
|
||||
{
|
||||
"name": "w1nk",
|
||||
"url": "https://github.com/w1nk"
|
||||
},
|
||||
{
|
||||
"name": "Hugh Kennedy",
|
||||
"url": "http://twitter.com/hughskennedy"
|
||||
},
|
||||
{
|
||||
"name": "Dustin Diaz",
|
||||
"url": "http://dustindiaz.com"
|
||||
},
|
||||
{
|
||||
"name": "Ilya Shaisultanov",
|
||||
"url": "https://github.com/diversario"
|
||||
},
|
||||
{
|
||||
"name": "Nathan MacInnes",
|
||||
"email": "nathan@macinn.es",
|
||||
"url": "http://macinn.es/"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin E. Coe",
|
||||
"email": "ben@npmjs.com",
|
||||
"url": "https://twitter.com/benjamincoe"
|
||||
},
|
||||
{
|
||||
"name": "Nathan Zadoks",
|
||||
"url": "https://github.com/nathan7"
|
||||
},
|
||||
{
|
||||
"name": "Róbert Oroszi",
|
||||
"email": "robert+gh@oroszi.net",
|
||||
"url": "https://github.com/oroce"
|
||||
},
|
||||
{
|
||||
"name": "Aurélio A. Heckert",
|
||||
"url": "http://softwarelivre.org/aurium"
|
||||
},
|
||||
{
|
||||
"name": "Guy Ellis",
|
||||
"url": "http://www.guyellisrocks.com/"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "deep cloning of objects and arrays",
|
||||
"devDependencies": {
|
||||
"nodeunit": "~0.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
},
|
||||
"homepage": "https://github.com/pvorb/node-clone#readme",
|
||||
"license": "MIT",
|
||||
"main": "clone.js",
|
||||
"name": "clone",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/pvorb/node-clone.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test.js"
|
||||
},
|
||||
"tags": [
|
||||
"clone",
|
||||
"object",
|
||||
"array",
|
||||
"function",
|
||||
"date"
|
||||
],
|
||||
"version": "1.0.4"
|
||||
}
|
||||
73
node_modules/color/package.json
generated
vendored
Normal file
73
node_modules/color/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "color@^0.11.0",
|
||||
"_id": "color@0.11.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-bXtcdPtl6EHNSHkq0e1eB7kE12Q=",
|
||||
"_location": "/color",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "color@^0.11.0",
|
||||
"name": "color",
|
||||
"escapedName": "color",
|
||||
"rawSpec": "^0.11.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.11.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/colormin"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/color/-/color-0.11.4.tgz",
|
||||
"_shasum": "6d7b5c74fb65e841cd48792ad1ed5e07b904d764",
|
||||
"_spec": "color@^0.11.0",
|
||||
"_where": "/Applications/XAMPP/xamppfiles/htdocs/wordpress/t-latehome/wp-content/plugins/opal-estate-pro/node_modules/colormin",
|
||||
"authors": [
|
||||
"Heather Arthur <fayearthur@gmail.com>",
|
||||
"Maxime Thirouin",
|
||||
"Josh Junon"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Qix-/color/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"clone": "^1.0.2",
|
||||
"color-convert": "^1.3.0",
|
||||
"color-string": "^0.3.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Color conversion and manipulation with CSS string support",
|
||||
"devDependencies": {
|
||||
"mocha": "^2.2.5",
|
||||
"xo": "^0.12.1"
|
||||
},
|
||||
"files": [
|
||||
"CHANGELOG.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/Qix-/color#readme",
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"css"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "color",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Qix-/color.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.11.4",
|
||||
"xo": {
|
||||
"rules": {
|
||||
"no-cond-assign": 0,
|
||||
"new-cap": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user