UNPKG

@runejs/common

Version:

Common logging, networking, compression, and other miscellaneous functionality for RuneJS.

32 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Color = exports.constants = void 0; exports.constants = { black_hue: 0, white_hue: 0, black_saturation: 0, white_saturation: 0 }; class Color { constructor(format, alpha = 255) { if (!format) { throw new Error(`Invalid color format ${format}.`); } if (alpha < 0 || alpha > 255) { throw new Error(`Alpha value must be between 0-255, received ${alpha}.`); } this.format = format; this.alpha = alpha; } static values(colorValues) { return Object.assign({}, colorValues); } values(colorValues) { if (colorValues.hasOwnProperty('alpha')) { return Object.assign(Object.assign({}, colorValues), { format: this.format }); } return Object.assign(Object.assign({}, colorValues), { format: this.format, alpha: this.alpha }); } } exports.Color = Color; //# sourceMappingURL=color.js.map