UNPKG

color-fns

Version:

Modern JavaScript color utility library.

13 lines 505 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function expandHexShorthand(hex) { var regex = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])*$/i; if ((hex.length === 5 || hex.length === 4) && regex.test(hex)) { hex = hex.replace(regex, function (m, r, g, b, a) { return "#" + r + r + g + g + b + b + (a ? "" + a + a : ''); }); } return hex; } exports.expandHexShorthand = expandHexShorthand; //# sourceMappingURL=expandHexShorthand.js.map