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.

43 lines 1.29 kB
import { Utils } from "../ColorsOld"; import { ColorSpace } from "./ColorSpace"; import { ProcessColor } from "./ProcessColor"; import { validateComponent } from "./ValidationUtils"; export class LabColor extends ProcessColor { constructor(l, a, b, alpha, profile = null) { super(alpha, profile); this._colorSpace = ColorSpace.Lab; this._l = validateComponent(l); this._a = validateComponent(a, -128, 127); this._b = validateComponent(b, -128, 127); } get l() { return this._l; } get a() { return this._a; } get b() { return this._b; } clone() { return new LabColor(this.l, this.a, this.b, this.alpha, this.profile); } equals(other) { const labOther = other; return super.equals(other) && labOther.l === this.l && labOther.a === this.a && labOther.b === this.b; } getData() { const data = super.getData(); data.l = this.l; data.a = this.a; data.b = this.b; return data; } toString() { return `lab(${this.l},${this.a},${this.b},${Utils.convertByteToPercent(this.alpha)})`; } } //# sourceMappingURL=LabColor.js.map