1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports["default"] = rgba;
|
5 | var _parseToRgb = _interopRequireDefault(require("./parseToRgb"));
|
6 | var _rgb = _interopRequireDefault(require("./rgb"));
|
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 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | function rgba(firstValue, secondValue, thirdValue, fourthValue) {
|
44 | if (typeof firstValue === 'string' && typeof secondValue === 'number') {
|
45 | var rgbValue = (0, _parseToRgb["default"])(firstValue);
|
46 | return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
|
47 | } else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
|
48 | return fourthValue >= 1 ? (0, _rgb["default"])(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
|
49 | } else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
|
50 | return firstValue.alpha >= 1 ? (0, _rgb["default"])(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
|
51 | }
|
52 | throw new _errors["default"](7);
|
53 | }
|
54 | module.exports = exports.default; |
\ | No newline at end of file |