1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports["default"] = hsla;
|
5 | var _hslToHex = _interopRequireDefault(require("../internalHelpers/_hslToHex"));
|
6 | var _hslToRgb = _interopRequireDefault(require("../internalHelpers/_hslToRgb"));
|
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 |
|
34 |
|
35 | function hsla(value, saturation, lightness, alpha) {
|
36 | if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
|
37 | return alpha >= 1 ? (0, _hslToHex["default"])(value, saturation, lightness) : "rgba(" + (0, _hslToRgb["default"])(value, saturation, lightness) + "," + alpha + ")";
|
38 | } else if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
|
39 | return value.alpha >= 1 ? (0, _hslToHex["default"])(value.hue, value.saturation, value.lightness) : "rgba(" + (0, _hslToRgb["default"])(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
|
40 | }
|
41 | throw new _errors["default"](2);
|
42 | }
|
43 | module.exports = exports.default; |
\ | No newline at end of file |