1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports["default"] = rgbToColorString;
|
5 | var _rgb = _interopRequireDefault(require("./rgb"));
|
6 | var _rgba = _interopRequireDefault(require("./rgba"));
|
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 rgbToColorString(color) {
|
34 | if (typeof color === 'object' && typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number') {
|
35 | if (typeof color.alpha === 'number') {
|
36 | return (0, _rgba["default"])({
|
37 | red: color.red,
|
38 | green: color.green,
|
39 | blue: color.blue,
|
40 | alpha: color.alpha
|
41 | });
|
42 | }
|
43 | return (0, _rgb["default"])({
|
44 | red: color.red,
|
45 | green: color.green,
|
46 | blue: color.blue
|
47 | });
|
48 | }
|
49 | throw new _errors["default"](46);
|
50 | }
|
51 | module.exports = exports.default; |
\ | No newline at end of file |