aboutsummaryrefslogtreecommitdiff
path: root/node_modules/colormin
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/colormin')
-rw-r--r--node_modules/colormin/CHANGELOG.md45
-rw-r--r--node_modules/colormin/LICENSE-MIT22
-rw-r--r--node_modules/colormin/README.md61
-rw-r--r--node_modules/colormin/dist/index.js80
-rw-r--r--node_modules/colormin/dist/lib/colourNames.js19
-rw-r--r--node_modules/colormin/dist/lib/colourType.js35
-rw-r--r--node_modules/colormin/dist/lib/stripWhitespace.js9
-rw-r--r--node_modules/colormin/dist/lib/toLonghand.js16
-rw-r--r--node_modules/colormin/dist/lib/toShorthand.js12
-rw-r--r--node_modules/colormin/dist/lib/trimLeadingZero.js9
-rw-r--r--node_modules/colormin/package.json57
11 files changed, 365 insertions, 0 deletions
diff --git a/node_modules/colormin/CHANGELOG.md b/node_modules/colormin/CHANGELOG.md
new file mode 100644
index 00000000..413365ea
--- /dev/null
+++ b/node_modules/colormin/CHANGELOG.md
@@ -0,0 +1,45 @@
+# 1.1.2
+
+* Improved performance of `isKeyword` (thanks to @maxnordlund & @ljharb).
+
+# 1.1.1
+
+* Bump css-color-names to 0.0.4.
+
+# 1.1.0
+
+* Add a legacy option for old Internet Explorer versions.
+
+# 1.0.7
+
+* Update color to 0.11.0.
+
+# 1.0.6
+
+* Now passes through invalid colour functions.
+
+# 1.0.5
+
+* Performance tweaks.
+* Update css-color-names to 0.0.3.
+
+# 1.0.4
+
+* Fixes an issue with the last patch - module was not working correctly on
+ Node 0.10.
+
+# 1.0.3
+
+* Updated to ES6.
+
+# 1.0.2
+
+* Improved regex for finding leading zeroes.
+
+# 1.0.1
+
+* Update color to 0.8.0.
+
+# 1.0.0
+
+* Initial release.
diff --git a/node_modules/colormin/LICENSE-MIT b/node_modules/colormin/LICENSE-MIT
new file mode 100644
index 00000000..fd0e863a
--- /dev/null
+++ b/node_modules/colormin/LICENSE-MIT
@@ -0,0 +1,22 @@
+Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
+
+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.
diff --git a/node_modules/colormin/README.md b/node_modules/colormin/README.md
new file mode 100644
index 00000000..a8a1f22a
--- /dev/null
+++ b/node_modules/colormin/README.md
@@ -0,0 +1,61 @@
+# colormin [![Build Status](https://travis-ci.org/ben-eb/colormin.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/colormin.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/colormin.svg)][deps]
+
+> Turn a CSS color into its smallest representation.
+
+## Install
+
+With [npm](https://npmjs.org/package/colormin) do:
+
+```
+npm install colormin --save
+```
+
+
+## Example
+
+```js
+var colormin = require('colormin');
+console.log(colormin('rgba(255, 0, 0, 1)'));
+
+// => 'red'
+```
+
+colormin works for rgb, rgba, hsl, hsla, hex & css color keywords. See more
+example output in the [tests](src/__tests__/index.js). Note that colormin does
+not convert invalid CSS colors, as it is not a color validator.
+
+
+## API
+
+### colormin(color, [options])
+
+#### color
+
+Type: `string`
+
+The color to minify.
+
+#### options
+
+##### legacy
+
+Type: `boolean`
+Default: `false`
+
+Set this to `true` to enable IE < 10 compatibility; the browser chokes on the
+`transparent` keyword, so in this mode the conversion from `rgba(0,0,0,0)`
+is turned off.
+
+## Contributing
+
+Pull requests are welcome. If you add functionality, then please add unit tests
+to cover it.
+
+
+## License
+
+MIT © [Ben Briggs](http://beneb.info)
+
+[ci]: https://travis-ci.org/ben-eb/colormin
+[deps]: https://gemnasium.com/ben-eb/colormin
+[npm]: http://badge.fury.io/js/colormin
diff --git a/node_modules/colormin/dist/index.js b/node_modules/colormin/dist/index.js
new file mode 100644
index 00000000..6ee5fc37
--- /dev/null
+++ b/node_modules/colormin/dist/index.js
@@ -0,0 +1,80 @@
+'use strict';
+
+exports.__esModule = true;
+
+var _color = require('color');
+
+var _color2 = _interopRequireDefault(_color);
+
+var _colourNames = require('./lib/colourNames');
+
+var _colourNames2 = _interopRequireDefault(_colourNames);
+
+var _toShorthand = require('./lib/toShorthand');
+
+var _toShorthand2 = _interopRequireDefault(_toShorthand);
+
+var _colourType = require('./lib/colourType');
+
+var ctype = _interopRequireWildcard(_colourType);
+
+var _stripWhitespace = require('./lib/stripWhitespace');
+
+var _stripWhitespace2 = _interopRequireDefault(_stripWhitespace);
+
+var _trimLeadingZero = require('./lib/trimLeadingZero');
+
+var _trimLeadingZero2 = _interopRequireDefault(_trimLeadingZero);
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var filterColor = function filterColor(callback) {
+ return Object.keys(_colourNames2.default).filter(callback);
+};
+var shorter = function shorter(a, b) {
+ return (a && a.length < b.length ? a : b).toLowerCase();
+};
+
+exports.default = function (colour) {
+ var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
+
+ if (ctype.isRGBorHSL(colour)) {
+ var c = void 0;
+ // Pass through invalid rgb/hsl functions
+ try {
+ c = (0, _color2.default)(colour);
+ } catch (err) {
+ return colour;
+ }
+ if (c.alpha() === 1) {
+ // At full alpha, just use hex
+ colour = c.hexString();
+ } else {
+ var rgb = c.rgb();
+ if (!opts.legacy && !rgb.r && !rgb.g && !rgb.b && !rgb.a) {
+ return 'transparent';
+ }
+ var hsla = c.hslaString();
+ var rgba = c.rgbString();
+ return (0, _trimLeadingZero2.default)((0, _stripWhitespace2.default)(hsla.length < rgba.length ? hsla : rgba));
+ }
+ }
+ if (ctype.isHex(colour)) {
+ colour = (0, _toShorthand2.default)(colour.toLowerCase());
+ var keyword = filterColor(function (key) {
+ return _colourNames2.default[key] === colour;
+ })[0];
+ return shorter(keyword, colour);
+ } else if (ctype.isKeyword(colour)) {
+ var hex = _colourNames2.default[filterColor(function (k) {
+ return k === colour.toLowerCase();
+ })[0]];
+ return shorter(hex, colour);
+ }
+ // Possibly malformed, just pass through
+ return colour;
+};
+
+module.exports = exports['default']; \ No newline at end of file
diff --git a/node_modules/colormin/dist/lib/colourNames.js b/node_modules/colormin/dist/lib/colourNames.js
new file mode 100644
index 00000000..6948271f
--- /dev/null
+++ b/node_modules/colormin/dist/lib/colourNames.js
@@ -0,0 +1,19 @@
+'use strict';
+
+exports.__esModule = true;
+
+var _cssColorNames = require('css-color-names');
+
+var _cssColorNames2 = _interopRequireDefault(_cssColorNames);
+
+var _toShorthand = require('./toShorthand');
+
+var _toShorthand2 = _interopRequireDefault(_toShorthand);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+Object.keys(_cssColorNames2.default).forEach(function (c) {
+ return _cssColorNames2.default[c] = (0, _toShorthand2.default)(_cssColorNames2.default[c]);
+});
+exports.default = _cssColorNames2.default;
+module.exports = exports['default']; \ No newline at end of file
diff --git a/node_modules/colormin/dist/lib/colourType.js b/node_modules/colormin/dist/lib/colourType.js
new file mode 100644
index 00000000..f2ea803b
--- /dev/null
+++ b/node_modules/colormin/dist/lib/colourType.js
@@ -0,0 +1,35 @@
+'use strict';
+
+exports.__esModule = true;
+exports.isKeyword = exports.isRGBorHSL = exports.isHex = undefined;
+
+var _has = require('has');
+
+var _has2 = _interopRequireDefault(_has);
+
+var _colourNames = require('./colourNames');
+
+var _colourNames2 = _interopRequireDefault(_colourNames);
+
+var _toLonghand = require('./toLonghand');
+
+var _toLonghand2 = _interopRequireDefault(_toLonghand);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var isHex = exports.isHex = function isHex(colour) {
+ if (colour[0] === '#') {
+ var c = (0, _toLonghand2.default)(colour).substring(1);
+ return c.length === 6 && !isNaN(parseInt(c, 16));
+ }
+ return false;
+};
+
+var isRGBorHSL = exports.isRGBorHSL = function isRGBorHSL(colour) {
+ return (/^(rgb|hsl)a?\(.*?\)/.test(colour)
+ );
+};
+
+var isKeyword = exports.isKeyword = function isKeyword(colour) {
+ return (0, _has2.default)(_colourNames2.default, colour.toLowerCase());
+}; \ No newline at end of file
diff --git a/node_modules/colormin/dist/lib/stripWhitespace.js b/node_modules/colormin/dist/lib/stripWhitespace.js
new file mode 100644
index 00000000..e279c8db
--- /dev/null
+++ b/node_modules/colormin/dist/lib/stripWhitespace.js
@@ -0,0 +1,9 @@
+'use strict';
+
+exports.__esModule = true;
+
+exports.default = function (str) {
+ return str.replace(/\s/g, '');
+};
+
+module.exports = exports['default']; \ No newline at end of file
diff --git a/node_modules/colormin/dist/lib/toLonghand.js b/node_modules/colormin/dist/lib/toLonghand.js
new file mode 100644
index 00000000..94377f43
--- /dev/null
+++ b/node_modules/colormin/dist/lib/toLonghand.js
@@ -0,0 +1,16 @@
+'use strict';
+
+exports.__esModule = true;
+
+exports.default = function (hex) {
+ if (hex.length !== 4) {
+ return hex;
+ }
+
+ var r = hex[1];
+ var g = hex[2];
+ var b = hex[3];
+ return '#' + r + r + g + g + b + b;
+};
+
+module.exports = exports['default']; \ No newline at end of file
diff --git a/node_modules/colormin/dist/lib/toShorthand.js b/node_modules/colormin/dist/lib/toShorthand.js
new file mode 100644
index 00000000..dd305707
--- /dev/null
+++ b/node_modules/colormin/dist/lib/toShorthand.js
@@ -0,0 +1,12 @@
+'use strict';
+
+exports.__esModule = true;
+
+exports.default = function (hex) {
+ if (hex.length === 7 && hex[1] === hex[2] && hex[3] === hex[4] && hex[5] === hex[6]) {
+ return '#' + hex[2] + hex[4] + hex[6];
+ }
+ return hex;
+};
+
+module.exports = exports['default']; \ No newline at end of file
diff --git a/node_modules/colormin/dist/lib/trimLeadingZero.js b/node_modules/colormin/dist/lib/trimLeadingZero.js
new file mode 100644
index 00000000..65d8508a
--- /dev/null
+++ b/node_modules/colormin/dist/lib/trimLeadingZero.js
@@ -0,0 +1,9 @@
+'use strict';
+
+exports.__esModule = true;
+
+exports.default = function (str) {
+ return str.replace(/([^\d])0(\.\d*)/g, '$1$2');
+};
+
+module.exports = exports['default']; \ No newline at end of file
diff --git a/node_modules/colormin/package.json b/node_modules/colormin/package.json
new file mode 100644
index 00000000..b5d17476
--- /dev/null
+++ b/node_modules/colormin/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "colormin",
+ "version": "1.1.2",
+ "description": "Turn a CSS color into its smallest representation.",
+ "main": "dist/index.js",
+ "files": [
+ "LICENSE-MIT",
+ "dist"
+ ],
+ "scripts": {
+ "pretest": "eslint src",
+ "prepublish": "del-cli dist && babel src --out-dir dist --ignore /__tests__/",
+ "test": "ava src/__tests__",
+ "test-012": "ava src/__tests__"
+ },
+ "homepage": "https://github.com/ben-eb/colormin",
+ "keywords": [
+ "color",
+ "colors",
+ "compression",
+ "css",
+ "minify"
+ ],
+ "author": {
+ "name": "Ben Briggs",
+ "email": "beneb.info@gmail.com",
+ "url": "http://beneb.info"
+ },
+ "license": "MIT",
+ "dependencies": {
+ "color": "^0.11.0",
+ "css-color-names": "0.0.4",
+ "has": "^1.0.1"
+ },
+ "devDependencies": {
+ "ava": "^0.16.0",
+ "babel-cli": "^6.3.17",
+ "babel-core": "^6.3.26",
+ "babel-plugin-add-module-exports": "^0.2.0",
+ "babel-preset-es2015": "^6.3.13",
+ "babel-preset-es2015-loose": "^7.0.0",
+ "babel-preset-stage-0": "^6.3.13",
+ "babel-register": "^6.9.0",
+ "del-cli": "^0.2.0",
+ "eslint": "^3.0.0",
+ "eslint-config-cssnano": "^3.0.0",
+ "eslint-plugin-babel": "^3.3.0",
+ "eslint-plugin-import": "^1.10.2"
+ },
+ "repository": "ben-eb/colormin",
+ "eslintConfig": {
+ "extends": "cssnano"
+ },
+ "ava": {
+ "require": "babel-register"
+ }
+}