@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.
19 lines • 728 B
JavaScript
import * as CommonUtils from "../Utils/Utils";
import { Clamp } from "../Math";
import { RgbColor } from "./RgbColor";
var Utils = /** @class */ (function () {
function Utils() {
}
Utils.isValidRgbColor = function (value) {
return !CommonUtils.isNullOrEmptyOrWhiteSpace(value) && (RgbColor.matchRgb(value) != null || RgbColor.matchRgba(value) != null);
};
Utils.convertPercentToByte = function (value) {
return Clamp(0, parseInt((parseFloat(value) * 255 / 100).toFixed(0)), 255);
};
Utils.convertByteToPercent = function (value) {
return (value / 255 * 100).toFixed(0) + "%";
};
return Utils;
}());
export { Utils };
//# sourceMappingURL=Utils.js.map