UNPKG

@aurigma/design-atoms

Version:

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

21 lines 866 B
import { BaseCommand } from "../BaseCommand"; import { ArgumentException } from "@aurigma/design-atoms-model/Exception"; export class ParseColorCommand extends BaseCommand { constructor(args, _viewer) { super(args); this._viewer = _viewer; } async execute() { var _a; if (!((_a = this._args) === null || _a === void 0 ? void 0 : _a.colorString)) { throw new ArgumentException("ParseColorCommand: colorString must not be empty."); } const colorParser = this._viewer.colorParser; const color = colorParser.parse(this._args.colorString); if (!color) { throw new ArgumentException(`ParseColorCommand: Failed to parse color from string: ${this._args.colorString}`); } return color; } } //# sourceMappingURL=ParseColorCommand.js.map