1 | ;
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports["default"] = parseToHsl;
|
5 | var _parseToRgb = _interopRequireDefault(require("./parseToRgb"));
|
6 | var _rgbToHsl = _interopRequireDefault(require("../internalHelpers/_rgbToHsl"));
|
7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
8 | /**
|
9 | * Returns an HslColor or HslaColor object. This utility function is only useful
|
10 | * if want to extract a color component. With the color util `toColorString` you
|
11 | * can convert a HslColor or HslaColor object back to a string.
|
12 | *
|
13 | * @example
|
14 | * // Assigns `{ hue: 0, saturation: 1, lightness: 0.5 }` to color1
|
15 | * const color1 = parseToHsl('rgb(255, 0, 0)');
|
16 | * // Assigns `{ hue: 128, saturation: 1, lightness: 0.5, alpha: 0.75 }` to color2
|
17 | * const color2 = parseToHsl('hsla(128, 100%, 50%, 0.75)');
|
18 | */
|
19 | function parseToHsl(color) {
|
20 | // Note: At a later stage we can optimize this function as right now a hsl
|
21 | // color would be parsed converted to rgb values and converted back to hsl.
|
22 | return (0, _rgbToHsl["default"])((0, _parseToRgb["default"])(color));
|
23 | }
|
24 | module.exports = exports.default; |
\ | No newline at end of file |