@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.
73 lines • 2.71 kB
JavaScript
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 { Utils } from "../ColorsOld";
import { ColorSpace } from "./ColorSpace";
import { ProcessColor } from "./ProcessColor";
import { validateComponent } from "./ValidationUtils";
var LabColor = /** @class */ (function (_super) {
__extends(LabColor, _super);
function LabColor(l, a, b, alpha, profile) {
if (profile === void 0) { profile = null; }
var _this = _super.call(this, alpha, profile) || this;
_this._colorSpace = ColorSpace.Lab;
_this._l = validateComponent(l);
_this._a = validateComponent(a, -128, 127);
_this._b = validateComponent(b, -128, 127);
return _this;
}
Object.defineProperty(LabColor.prototype, "l", {
get: function () {
return this._l;
},
enumerable: true,
configurable: true
});
Object.defineProperty(LabColor.prototype, "a", {
get: function () {
return this._a;
},
enumerable: true,
configurable: true
});
Object.defineProperty(LabColor.prototype, "b", {
get: function () {
return this._b;
},
enumerable: true,
configurable: true
});
LabColor.prototype.clone = function () {
return new LabColor(this.l, this.a, this.b, this.alpha, this.profile);
};
LabColor.prototype.equals = function (other) {
var labOther = other;
return _super.prototype.equals.call(this, other)
&& labOther.l === this.l
&& labOther.a === this.a
&& labOther.b === this.b;
};
LabColor.prototype.getData = function () {
var data = _super.prototype.getData.call(this);
data.l = this.l;
data.a = this.a;
data.b = this.b;
return data;
};
LabColor.prototype.toString = function () {
return "lab(" + this.l + "," + this.a + "," + this.b + "," + Utils.convertByteToPercent(this.alpha) + ")";
};
return LabColor;
}(ProcessColor));
export { LabColor };
//# sourceMappingURL=LabColor.js.map