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.

15 lines 599 B
import * as CommonUtils from "../Utils/Utils"; import { Clamp } from "../Math"; import { RgbColor } from "./RgbColor"; export class Utils { static isValidRgbColor(value) { return !CommonUtils.isNullOrEmptyOrWhiteSpace(value) && (RgbColor.matchRgb(value) != null || RgbColor.matchRgba(value) != null); } static convertPercentToByte(value) { return Clamp(0, parseInt((parseFloat(value) * 255 / 100).toFixed(0)), 255); } static convertByteToPercent(value) { return `${(value / 255 * 100).toFixed(0)}%`; } } //# sourceMappingURL=Utils.js.map