UNPKG

638 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.correctRGB = void 0;
4var consts_1 = require("./consts");
5var clamp_1 = require("./clamp");
6/** Corrects an RGB color to fall within the valid range. */
7function correctRGB(color) {
8 return {
9 r: clamp_1.clamp(color.r, consts_1.MAX_COLOR_RGB),
10 g: clamp_1.clamp(color.g, consts_1.MAX_COLOR_RGB),
11 b: clamp_1.clamp(color.b, consts_1.MAX_COLOR_RGB),
12 a: typeof color.a === 'number' ? clamp_1.clamp(color.a, consts_1.MAX_COLOR_ALPHA) : color.a,
13 };
14}
15exports.correctRGB = correctRGB;
16//# sourceMappingURL=correctRGB.js.map
\No newline at end of file