UNPKG

@aurigma/design-atoms-model

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

76 lines 2.77 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { ColorSpace } from "./ColorSpace"; import { ProcessColor } from "./ProcessColor"; import { validateComponent } from "./ValidationUtils"; var RgbColor = /** @class */ (function (_super) { __extends(RgbColor, _super); function RgbColor(r, g, b, alpha, profile) { if (profile === void 0) { profile = null; } var _this = _super.call(this, alpha, profile) || this; _this._colorSpace = ColorSpace.Rgb; _this._r = validateComponent(r); _this._g = validateComponent(g); _this._b = validateComponent(b); return _this; } Object.defineProperty(RgbColor.prototype, "r", { get: function () { return this._r; }, enumerable: true, configurable: true }); Object.defineProperty(RgbColor.prototype, "g", { get: function () { return this._g; }, enumerable: true, configurable: true }); Object.defineProperty(RgbColor.prototype, "b", { get: function () { return this._b; }, enumerable: true, configurable: true }); RgbColor.prototype.equals = function (other) { var rgbOther = other; return _super.prototype.equals.call(this, other) && this.r === rgbOther.r && this.g === rgbOther.g && this.b === rgbOther.b; }; RgbColor.prototype.clone = function () { return new RgbColor(this.r, this.g, this.b, this.alpha, this.profile); }; RgbColor.prototype.getData = function () { var data = _super.prototype.getData.call(this); data.r = this.r; data.g = this.g; data.b = this.b; return data; }; RgbColor.prototype.toString = function () { if (this.alpha === 255) { return "rgb(" + this.r + "," + this.g + "," + this.b + ")"; } var a = (this.alpha / 255).toFixed(7); return "rgba(" + this.r + "," + this.g + "," + this.b + "," + a + ")"; }; return RgbColor; }(ProcessColor)); export { RgbColor }; //# sourceMappingURL=RgbColor.js.map