1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports["default"] = hslToColorString;
|
5 | var _hsl = _interopRequireDefault(require("./hsl"));
|
6 | var _hsla = _interopRequireDefault(require("./hsla"));
|
7 | var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
|
8 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | function hslToColorString(color) {
|
34 | if (typeof color === 'object' && typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number') {
|
35 | if (color.alpha && typeof color.alpha === 'number') {
|
36 | return (0, _hsla["default"])({
|
37 | hue: color.hue,
|
38 | saturation: color.saturation,
|
39 | lightness: color.lightness,
|
40 | alpha: color.alpha
|
41 | });
|
42 | }
|
43 | return (0, _hsl["default"])({
|
44 | hue: color.hue,
|
45 | saturation: color.saturation,
|
46 | lightness: color.lightness
|
47 | });
|
48 | }
|
49 | throw new _errors["default"](45);
|
50 | }
|
51 | module.exports = exports.default; |
\ | No newline at end of file |