1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.rgb2hex = void 0;
|
4 | var consts_1 = require("./consts");
|
5 | var clamp_1 = require("./clamp");
|
6 |
|
7 | function rgb2hex(r, g, b) {
|
8 | return [_rgbToPaddedHex(r), _rgbToPaddedHex(g), _rgbToPaddedHex(b)].join('');
|
9 | }
|
10 | exports.rgb2hex = rgb2hex;
|
11 |
|
12 | function _rgbToPaddedHex(num) {
|
13 | num = clamp_1.clamp(num, consts_1.MAX_COLOR_RGB);
|
14 | var hex = num.toString(16);
|
15 | return hex.length === 1 ? '0' + hex : hex;
|
16 | }
|
17 |
|
\ | No newline at end of file |