nav tabs on admin dashboard
This commit is contained in:
7
node_modules/color-string/CHANGELOG.md
generated
vendored
7
node_modules/color-string/CHANGELOG.md
generated
vendored
@@ -1,3 +1,10 @@
|
||||
# 0.4.0
|
||||
|
||||
- Changed: Invalid conversions now return `null` instead of `undefined`
|
||||
- Changed: Moved to XO standard
|
||||
- Fixed: a few details in package.json
|
||||
- Fixed: readme output regarding wrapped hue values ([#21](https://github.com/MoOx/color-string/pull/21))
|
||||
|
||||
# 0.3.0
|
||||
|
||||
- Fixed: HSL alpha channel ([#16](https://github.com/harthur/color-string/pull/16))
|
||||
|
||||
74
node_modules/color-string/README.md
generated
vendored
74
node_modules/color-string/README.md
generated
vendored
@@ -1,36 +1,58 @@
|
||||
# color-string
|
||||
color-string is a library for parsing and generating CSS color strings.
|
||||
|
||||
#### parsing:
|
||||
```javascript
|
||||
colorString.getRgb("#FFF") // [255, 255, 255]
|
||||
colorString.getRgb("blue") // [0, 0, 255]
|
||||
[](https://travis-ci.org/Qix-/color-string)
|
||||
|
||||
colorString.getRgba("rgba(200, 60, 60, 0.3)") // [200, 60, 60, 0.3]
|
||||
colorString.getRgba("rgb(200, 200, 200)") // [200, 200, 200, 1]
|
||||
> library for parsing and generating CSS color strings.
|
||||
|
||||
colorString.getHsl("hsl(360, 100%, 50%)") // [360, 100, 50]
|
||||
colorString.getHsla("hsla(360, 60%, 50%, 0.4)") // [360, 60, 50, 0.4]
|
||||
## Install
|
||||
|
||||
colorString.getAlpha("rgba(200, 0, 12, 0.6)") // 0.6
|
||||
```
|
||||
#### generating:
|
||||
```javascript
|
||||
colorString.hexString([255, 255, 255]) // "#FFFFFF"
|
||||
colorString.rgbString([255, 255, 255]) // "rgb(255, 255, 255)"
|
||||
colorString.rgbString([0, 0, 255, 0.4]) // "rgba(0, 0, 255, 0.4)"
|
||||
colorString.rgbString([0, 0, 255], 0.4) // "rgba(0, 0, 255, 0.4)"
|
||||
colorString.percentString([0, 0, 255]) // "rgb(0%, 0%, 100%)"
|
||||
colorString.keyword([255, 255, 0]) // "yellow"
|
||||
colorString.hslString([360, 100, 100]) // "hsl(360, 100%, 100%)"
|
||||
With [npm](http://npmjs.org/):
|
||||
|
||||
```console
|
||||
$ npm install color-string
|
||||
```
|
||||
|
||||
# Install
|
||||
## Usage
|
||||
|
||||
### node
|
||||
For [node](http://nodejs.org) with [npm](http://npmjs.org):
|
||||
### Parsing
|
||||
|
||||
npm install color-string
|
||||
```js
|
||||
colorString.get('#FFF') // {model: 'rgb', value: [255, 255, 255, 1]}
|
||||
colorString.get('#FFFA') // {model: 'rgb', value: [255, 255, 255, 0.67]}
|
||||
colorString.get('#FFFFFFAA') // {model: 'rgb', value: [255, 255, 255, 0.67]}
|
||||
colorString.get('hsl(360, 100%, 50%)') // {model: 'hsl', value: [0, 100, 50, 1]}
|
||||
colorString.get('hwb(60, 3%, 60%)') // {model: 'hwb', value: [60, 3, 60, 1]}
|
||||
|
||||
### browser
|
||||
Download the latest [color-string.js](https://github.com/harthur/color-string/tree/gh-pages). The `colorString` object is exported.
|
||||
colorString.get.rgb('#FFF') // [255, 255, 255, 1]
|
||||
colorString.get.rgb('blue') // [0, 0, 255, 1]
|
||||
colorString.get.rgb('rgba(200, 60, 60, 0.3)') // [200, 60, 60, 0.3]
|
||||
colorString.get.rgb('rgb(200, 200, 200)') // [200, 200, 200, 1]
|
||||
|
||||
colorString.get.hsl('hsl(360, 100%, 50%)') // [0, 100, 50, 1]
|
||||
colorString.get.hsl('hsla(360, 60%, 50%, 0.4)') // [0, 60, 50, 0.4]
|
||||
|
||||
colorString.get.hwb('hwb(60, 3%, 60%)') // [60, 3, 60, 1]
|
||||
colorString.get.hwb('hwb(60, 3%, 60%, 0.6)') // [60, 3, 60, 0.6]
|
||||
|
||||
colorString.get.rgb('invalid color string') // null
|
||||
```
|
||||
|
||||
### Generation
|
||||
|
||||
```js
|
||||
colorString.to.hex([255, 255, 255]) // "#FFFFFF"
|
||||
colorString.to.hex([0, 0, 255, 0.4]) // "#0000FF66"
|
||||
colorString.to.hex([0, 0, 255], 0.4) // "#0000FF66"
|
||||
colorString.to.rgb([255, 255, 255]) // "rgb(255, 255, 255)"
|
||||
colorString.to.rgb([0, 0, 255, 0.4]) // "rgba(0, 0, 255, 0.4)"
|
||||
colorString.to.rgb([0, 0, 255], 0.4) // "rgba(0, 0, 255, 0.4)"
|
||||
colorString.to.rgb.percent([0, 0, 255]) // "rgb(0%, 0%, 100%)"
|
||||
colorString.to.keyword([255, 255, 0]) // "yellow"
|
||||
colorString.to.hsl([360, 100, 100]) // "hsl(360, 100%, 100%)"
|
||||
colorString.to.hwb([50, 3, 15]) // "hwb(50, 3%, 15%)"
|
||||
|
||||
// all functions also support swizzling
|
||||
colorString.to.rgb(0, [0, 255], 0.4) // "rgba(0, 0, 255, 0.4)"
|
||||
colorString.to.rgb([0, 0], [255], 0.4) // "rgba(0, 0, 255, 0.4)"
|
||||
colorString.to.rgb([0], 0, [255, 0.4]) // "rgba(0, 0, 255, 0.4)"
|
||||
```
|
||||
|
||||
221
node_modules/color-string/color-string.js
generated
vendored
221
node_modules/color-string/color-string.js
generated
vendored
@@ -1,221 +0,0 @@
|
||||
/* MIT license */
|
||||
var colorNames = require('color-name');
|
||||
|
||||
module.exports = {
|
||||
getRgba: getRgba,
|
||||
getHsla: getHsla,
|
||||
getRgb: getRgb,
|
||||
getHsl: getHsl,
|
||||
getHwb: getHwb,
|
||||
getAlpha: getAlpha,
|
||||
|
||||
hexString: hexString,
|
||||
rgbString: rgbString,
|
||||
rgbaString: rgbaString,
|
||||
percentString: percentString,
|
||||
percentaString: percentaString,
|
||||
hslString: hslString,
|
||||
hslaString: hslaString,
|
||||
hwbString: hwbString,
|
||||
keyword: keyword
|
||||
}
|
||||
|
||||
function getRgba(string) {
|
||||
if (!string) {
|
||||
return;
|
||||
}
|
||||
var abbr = /^#([a-fA-F0-9]{3})$/,
|
||||
hex = /^#([a-fA-F0-9]{6})$/,
|
||||
rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,
|
||||
per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,
|
||||
keyword = /(\D+)/;
|
||||
|
||||
var rgb = [0, 0, 0],
|
||||
a = 1,
|
||||
match = string.match(abbr);
|
||||
if (match) {
|
||||
match = match[1];
|
||||
for (var i = 0; i < rgb.length; i++) {
|
||||
rgb[i] = parseInt(match[i] + match[i], 16);
|
||||
}
|
||||
}
|
||||
else if (match = string.match(hex)) {
|
||||
match = match[1];
|
||||
for (var i = 0; i < rgb.length; i++) {
|
||||
rgb[i] = parseInt(match.slice(i * 2, i * 2 + 2), 16);
|
||||
}
|
||||
}
|
||||
else if (match = string.match(rgba)) {
|
||||
for (var i = 0; i < rgb.length; i++) {
|
||||
rgb[i] = parseInt(match[i + 1]);
|
||||
}
|
||||
a = parseFloat(match[4]);
|
||||
}
|
||||
else if (match = string.match(per)) {
|
||||
for (var i = 0; i < rgb.length; i++) {
|
||||
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
|
||||
}
|
||||
a = parseFloat(match[4]);
|
||||
}
|
||||
else if (match = string.match(keyword)) {
|
||||
if (match[1] == "transparent") {
|
||||
return [0, 0, 0, 0];
|
||||
}
|
||||
rgb = colorNames[match[1]];
|
||||
if (!rgb) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < rgb.length; i++) {
|
||||
rgb[i] = scale(rgb[i], 0, 255);
|
||||
}
|
||||
if (!a && a != 0) {
|
||||
a = 1;
|
||||
}
|
||||
else {
|
||||
a = scale(a, 0, 1);
|
||||
}
|
||||
rgb[3] = a;
|
||||
return rgb;
|
||||
}
|
||||
|
||||
function getHsla(string) {
|
||||
if (!string) {
|
||||
return;
|
||||
}
|
||||
var hsl = /^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
|
||||
var match = string.match(hsl);
|
||||
if (match) {
|
||||
var alpha = parseFloat(match[4]);
|
||||
var h = scale(parseInt(match[1]), 0, 360),
|
||||
s = scale(parseFloat(match[2]), 0, 100),
|
||||
l = scale(parseFloat(match[3]), 0, 100),
|
||||
a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
|
||||
return [h, s, l, a];
|
||||
}
|
||||
}
|
||||
|
||||
function getHwb(string) {
|
||||
if (!string) {
|
||||
return;
|
||||
}
|
||||
var hwb = /^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
|
||||
var match = string.match(hwb);
|
||||
if (match) {
|
||||
var alpha = parseFloat(match[4]);
|
||||
var h = scale(parseInt(match[1]), 0, 360),
|
||||
w = scale(parseFloat(match[2]), 0, 100),
|
||||
b = scale(parseFloat(match[3]), 0, 100),
|
||||
a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
|
||||
return [h, w, b, a];
|
||||
}
|
||||
}
|
||||
|
||||
function getRgb(string) {
|
||||
var rgba = getRgba(string);
|
||||
return rgba && rgba.slice(0, 3);
|
||||
}
|
||||
|
||||
function getHsl(string) {
|
||||
var hsla = getHsla(string);
|
||||
return hsla && hsla.slice(0, 3);
|
||||
}
|
||||
|
||||
function getAlpha(string) {
|
||||
var vals = getRgba(string);
|
||||
if (vals) {
|
||||
return vals[3];
|
||||
}
|
||||
else if (vals = getHsla(string)) {
|
||||
return vals[3];
|
||||
}
|
||||
else if (vals = getHwb(string)) {
|
||||
return vals[3];
|
||||
}
|
||||
}
|
||||
|
||||
// generators
|
||||
function hexString(rgb) {
|
||||
return "#" + hexDouble(rgb[0]) + hexDouble(rgb[1])
|
||||
+ hexDouble(rgb[2]);
|
||||
}
|
||||
|
||||
function rgbString(rgba, alpha) {
|
||||
if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
|
||||
return rgbaString(rgba, alpha);
|
||||
}
|
||||
return "rgb(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ")";
|
||||
}
|
||||
|
||||
function rgbaString(rgba, alpha) {
|
||||
if (alpha === undefined) {
|
||||
alpha = (rgba[3] !== undefined ? rgba[3] : 1);
|
||||
}
|
||||
return "rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2]
|
||||
+ ", " + alpha + ")";
|
||||
}
|
||||
|
||||
function percentString(rgba, alpha) {
|
||||
if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
|
||||
return percentaString(rgba, alpha);
|
||||
}
|
||||
var r = Math.round(rgba[0]/255 * 100),
|
||||
g = Math.round(rgba[1]/255 * 100),
|
||||
b = Math.round(rgba[2]/255 * 100);
|
||||
|
||||
return "rgb(" + r + "%, " + g + "%, " + b + "%)";
|
||||
}
|
||||
|
||||
function percentaString(rgba, alpha) {
|
||||
var r = Math.round(rgba[0]/255 * 100),
|
||||
g = Math.round(rgba[1]/255 * 100),
|
||||
b = Math.round(rgba[2]/255 * 100);
|
||||
return "rgba(" + r + "%, " + g + "%, " + b + "%, " + (alpha || rgba[3] || 1) + ")";
|
||||
}
|
||||
|
||||
function hslString(hsla, alpha) {
|
||||
if (alpha < 1 || (hsla[3] && hsla[3] < 1)) {
|
||||
return hslaString(hsla, alpha);
|
||||
}
|
||||
return "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)";
|
||||
}
|
||||
|
||||
function hslaString(hsla, alpha) {
|
||||
if (alpha === undefined) {
|
||||
alpha = (hsla[3] !== undefined ? hsla[3] : 1);
|
||||
}
|
||||
return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, "
|
||||
+ alpha + ")";
|
||||
}
|
||||
|
||||
// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
|
||||
// (hwb have alpha optional & 1 is default value)
|
||||
function hwbString(hwb, alpha) {
|
||||
if (alpha === undefined) {
|
||||
alpha = (hwb[3] !== undefined ? hwb[3] : 1);
|
||||
}
|
||||
return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%"
|
||||
+ (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")";
|
||||
}
|
||||
|
||||
function keyword(rgb) {
|
||||
return reverseNames[rgb.slice(0, 3)];
|
||||
}
|
||||
|
||||
// helpers
|
||||
function scale(num, min, max) {
|
||||
return Math.min(Math.max(min, num), max);
|
||||
}
|
||||
|
||||
function hexDouble(num) {
|
||||
var str = num.toString(16).toUpperCase();
|
||||
return (str.length < 2) ? "0" + str : str;
|
||||
}
|
||||
|
||||
|
||||
//create a list of reverse color names
|
||||
var reverseNames = {};
|
||||
for (var name in colorNames) {
|
||||
reverseNames[colorNames[name]] = name;
|
||||
}
|
||||
47
node_modules/color-string/package.json
generated
vendored
47
node_modules/color-string/package.json
generated
vendored
@@ -1,33 +1,33 @@
|
||||
{
|
||||
"_from": "color-string@^0.3.0",
|
||||
"_id": "color-string@0.3.0",
|
||||
"_from": "color-string@^1.5.2",
|
||||
"_id": "color-string@1.5.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-J9RvtnAlxcL6JZk7+/V55HhBuZE=",
|
||||
"_integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==",
|
||||
"_location": "/color-string",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "color-string@^0.3.0",
|
||||
"raw": "color-string@^1.5.2",
|
||||
"name": "color-string",
|
||||
"escapedName": "color-string",
|
||||
"rawSpec": "^0.3.0",
|
||||
"rawSpec": "^1.5.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.3.0"
|
||||
"fetchSpec": "^1.5.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/color"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/color-string/-/color-string-0.3.0.tgz",
|
||||
"_shasum": "27d46fb67025c5c2fa25993bfbf579e47841b991",
|
||||
"_spec": "color-string@^0.3.0",
|
||||
"_resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz",
|
||||
"_shasum": "c9bbc5f01b58b5492f3d6857459cb6590ce204cc",
|
||||
"_spec": "color-string@^1.5.2",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\color",
|
||||
"author": {
|
||||
"name": "Heather Arthur",
|
||||
"email": "fayearthur@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/harthur/color-string/issues"
|
||||
"url": "https://github.com/Qix-/color-string/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
@@ -37,15 +37,24 @@
|
||||
{
|
||||
"name": "Dyma Ywanov",
|
||||
"email": "dfcreative@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Josh Junon"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"color-name": "^1.0.0"
|
||||
"color-name": "^1.0.0",
|
||||
"simple-swizzle": "^0.2.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Parser and generator for CSS color strings",
|
||||
"devDependencies": {},
|
||||
"homepage": "https://github.com/harthur/color-string#readme",
|
||||
"devDependencies": {
|
||||
"xo": "^0.12.1"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/Qix-/color-string#readme",
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
@@ -53,14 +62,20 @@
|
||||
"css"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./color-string",
|
||||
"name": "color-string",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/harthur/color-string.git"
|
||||
"url": "git+https://github.com/Qix-/color-string.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "node test/basic.js"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
"version": "1.5.3",
|
||||
"xo": {
|
||||
"rules": {
|
||||
"no-cond-assign": 0,
|
||||
"operator-linebreak": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
93
node_modules/color-string/test/basic.js
generated
vendored
93
node_modules/color-string/test/basic.js
generated
vendored
@@ -1,93 +0,0 @@
|
||||
var string = require("../color-string"),
|
||||
assert = require("assert");
|
||||
|
||||
|
||||
assert.deepEqual(string.getRgba("#fef"), [255, 238, 255, 1]);
|
||||
assert.deepEqual(string.getRgba("#fffFEF"), [255, 255, 239,1]);
|
||||
assert.deepEqual(string.getRgba("rgb(244, 233, 100)"), [244, 233, 100, 1]);
|
||||
assert.deepEqual(string.getRgba("rgb(100%, 30%, 90%)"), [255, 77, 229, 1]);
|
||||
assert.deepEqual(string.getRgba("transparent"), [0, 0, 0, 0]);
|
||||
assert.deepEqual(string.getHsla("hsl(240, 100%, 50.5%)"), [240, 100, 50.5, 1]);
|
||||
assert.deepEqual(string.getHsla("hsl(240deg, 100%, 50.5%)"), [240, 100, 50.5, 1]);
|
||||
assert.deepEqual(string.getHwb("hwb(240, 100%, 50.5%)"), [240, 100, 50.5, 1]);
|
||||
assert.deepEqual(string.getHwb("hwb(240deg, 100%, 50.5%)"), [240, 100, 50.5, 1]);
|
||||
|
||||
// with sign
|
||||
assert.deepEqual(string.getRgba("rgb(-244, +233, -100)"), [0, 233, 0, 1]);
|
||||
assert.deepEqual(string.getHsla("hsl(+240, 100%, 50.5%)"), [240, 100, 50.5, 1]);
|
||||
assert.deepEqual(string.getRgba("rgba(200, +20, -233, -0.0)"), [200, 20, 0, 0]);
|
||||
assert.deepEqual(string.getRgba("rgba(200, +20, -233, -0.0)"), [200, 20, 0, 0]);
|
||||
assert.deepEqual(string.getHsla("hsla(+200, 100%, 50%, -0.2)"), [200, 100, 50, 0]);
|
||||
assert.deepEqual(string.getHwb("hwb(+240, 100%, 50.5%)"), [240, 100, 50.5, 1]);
|
||||
assert.deepEqual(string.getHwb("hwb(-240deg, 100%, 50.5%)"), [0, 100, 50.5, 1]);
|
||||
assert.deepEqual(string.getHwb("hwb(-240deg, 100%, 50.5%, +0.6)"), [0, 100, 50.5, 0.6]);
|
||||
|
||||
//subsequent return values should not change array
|
||||
assert.deepEqual(string.getRgba("blue"), [0, 0, 255, 1]);
|
||||
assert.deepEqual(string.getRgba("blue"), [0, 0, 255, 1]);
|
||||
|
||||
assert.equal(string.getAlpha("rgb(244, 233, 100)"), 1);
|
||||
assert.equal(string.getAlpha("rgba(244, 233, 100, 0.5)"), 0.5);
|
||||
assert.equal(string.getAlpha("hsla(244, 100%, 100%, 0.6)"), 0.6);
|
||||
assert.equal(string.getAlpha("hwb(244, 100%, 100%, 0.6)"), 0.6);
|
||||
assert.equal(string.getAlpha("hwb(244, 100%, 100%)"), 1);
|
||||
|
||||
// alpha
|
||||
assert.deepEqual(string.getRgba("rgba(200, 20, 233, 0.2)"), [200, 20, 233, 0.2]);
|
||||
assert.deepEqual(string.getRgba("rgba(200, 20, 233, 0)"), [200, 20, 233, 0]);
|
||||
assert.deepEqual(string.getRgba("rgba(100%, 30%, 90%, 0.2)"), [255, 77, 229, 0.2]);
|
||||
assert.deepEqual(string.getHsla("hsla(200, 20%, 33%, 0.2)"), [200, 20, 33, 0.2]);
|
||||
assert.deepEqual(string.getHwb("hwb(200, 20%, 33%, 0.2)"), [200, 20, 33, 0.2]);
|
||||
|
||||
// no alpha
|
||||
assert.deepEqual(string.getRgb("#fef"), [255, 238, 255]);
|
||||
assert.deepEqual(string.getRgb("rgba(200, 20, 233, 0.2)"), [200, 20, 233]);
|
||||
assert.deepEqual(string.getHsl("hsl(240, 100%, 50.5%)"), [240, 100, 50.5]);
|
||||
assert.deepEqual(string.getRgba('rgba(0,0,0,0)'), [0, 0, 0, 0]);
|
||||
assert.deepEqual(string.getHsla('hsla(0,0%,0%,0)'), [0, 0, 0, 0]);
|
||||
assert.deepEqual(string.getHwb("hwb(400, 10%, 200%, 0)"), [360, 10, 100, 0]);
|
||||
|
||||
// range
|
||||
assert.deepEqual(string.getRgba("rgba(300, 600, 100, 3)"), [255, 255, 100, 1]);
|
||||
assert.deepEqual(string.getRgba("rgba(8000%, 100%, 333%, 88)"), [255, 255, 255, 1]);
|
||||
assert.deepEqual(string.getHsla("hsla(400, 10%, 200%, 10)"), [360, 10, 100, 1]);
|
||||
assert.deepEqual(string.getHwb("hwb(400, 10%, 200%, 10)"), [360, 10, 100, 1]);
|
||||
|
||||
// invalid
|
||||
assert.strictEqual(string.getRgba("yellowblue"), undefined);
|
||||
assert.strictEqual(string.getRgba("hsl(100, 10%, 10%)"), undefined);
|
||||
assert.strictEqual(string.getRgba("hwb(100, 10%, 10%)"), undefined);
|
||||
|
||||
// generators
|
||||
assert.equal(string.hexString([255, 10, 35]), "#FF0A23");
|
||||
|
||||
assert.equal(string.rgbString([255, 10, 35]), "rgb(255, 10, 35)");
|
||||
assert.equal(string.rgbString([255, 10, 35, 0.3]), "rgba(255, 10, 35, 0.3)");
|
||||
assert.equal(string.rgbString([255, 10, 35], 0.3), "rgba(255, 10, 35, 0.3)");
|
||||
assert.equal(string.rgbaString([255, 10, 35, 0.3]), "rgba(255, 10, 35, 0.3)");
|
||||
assert.equal(string.rgbaString([255, 10, 35], 0.3), "rgba(255, 10, 35, 0.3)");
|
||||
assert.equal(string.rgbaString([255, 10, 35]), "rgba(255, 10, 35, 1)");
|
||||
assert.equal(string.rgbaString([255, 10, 35, 0]), "rgba(255, 10, 35, 0)");
|
||||
|
||||
assert.equal(string.percentString([255, 10, 35]), "rgb(100%, 4%, 14%)");
|
||||
assert.equal(string.percentString([255, 10, 35, 0.3]), "rgba(100%, 4%, 14%, 0.3)");
|
||||
assert.equal(string.percentString([255, 10, 35], 0.3), "rgba(100%, 4%, 14%, 0.3)");
|
||||
assert.equal(string.percentaString([255, 10, 35, 0.3]), "rgba(100%, 4%, 14%, 0.3)");
|
||||
assert.equal(string.percentaString([255, 10, 35], 0.3), "rgba(100%, 4%, 14%, 0.3)");
|
||||
assert.equal(string.percentaString([255, 10, 35]), "rgba(100%, 4%, 14%, 1)");
|
||||
|
||||
assert.equal(string.hslString([280, 40, 60]), "hsl(280, 40%, 60%)");
|
||||
assert.equal(string.hslString([280, 40, 60, 0.3]), "hsla(280, 40%, 60%, 0.3)");
|
||||
assert.equal(string.hslString([280, 40, 60], 0.3), "hsla(280, 40%, 60%, 0.3)");
|
||||
assert.equal(string.hslaString([280, 40, 60, 0.3]), "hsla(280, 40%, 60%, 0.3)");
|
||||
assert.equal(string.hslaString([280, 40, 60], 0.3), "hsla(280, 40%, 60%, 0.3)");
|
||||
assert.equal(string.hslaString([280, 40, 60], 0), "hsla(280, 40%, 60%, 0)");
|
||||
assert.equal(string.hslaString([280, 40, 60]), "hsla(280, 40%, 60%, 1)");
|
||||
|
||||
assert.equal(string.hwbString([280, 40, 60]), "hwb(280, 40%, 60%)");
|
||||
assert.equal(string.hwbString([280, 40, 60, 0.3]), "hwb(280, 40%, 60%, 0.3)");
|
||||
assert.equal(string.hwbString([280, 40, 60], 0.3), "hwb(280, 40%, 60%, 0.3)");
|
||||
assert.equal(string.hwbString([280, 40, 60], 0), "hwb(280, 40%, 60%, 0)");
|
||||
|
||||
assert.equal(string.keyword([255, 255, 0]), "yellow");
|
||||
assert.equal(string.keyword([100, 255, 0]), undefined);
|
||||
Reference in New Issue
Block a user