Changeset e29cc2e for trip-planner-front/node_modules/postcss-colormin/dist
- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- Location:
- trip-planner-front/node_modules/postcss-colormin/dist
- Files:
-
- 2 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/postcss-colormin/dist/minifyColor.js
r59329aa re29cc2e 6 6 exports.default = minifyColor; 7 7 8 var _color = require("./lib/color");8 var _colord = require("colord"); 9 9 10 var _getShortestString = _interopRequireDefault(require("./lib/getShortestString")); 10 var _names = _interopRequireDefault(require("colord/plugins/names")); 11 12 var _minify = _interopRequireDefault(require("colord/plugins/minify")); 11 13 12 14 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 15 16 (0, _colord.extend)([_names.default, _minify.default]); 14 17 /** 15 18 * Performs color value minification … … 19 22 * @param {boolean} options.supportsTransparent – Does the browser support "transparent" value properly 20 23 */ 24 21 25 function minifyColor(input, options = {}) { 22 26 const settings = { … … 25 29 ...options 26 30 }; 27 const instance = (0, _color .process)(input);31 const instance = (0, _colord.colord)(input); 28 32 29 33 if (instance.isValid()) { 30 // Try to shorten the string if it is a valid CSS color value. 31 // Fall back to the original input if it's smaller or has equal length/ 32 return (0, _getShortestString.default)([input.toLowerCase(), instance.toShortString(settings)]); 34 // Try to shorten the string if it is a valid CSS color value 35 const minified = instance.minify({ 36 alphaHex: settings.supportsAlphaHex, 37 transparent: settings.supportsTransparent, 38 name: true 39 }); // Fall back to the original input if it's smaller or has equal length 40 41 return minified.length < input.length ? minified : input.toLowerCase(); 33 42 } else { 34 43 // Possibly malformed, so pass through
Note:
See TracChangeset
for help on using the changeset viewer.