playable
Version:
Video player based on HTML5Video
18 lines • 718 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var SHORTHAND_HEX_COLOR_PATTERN = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
var HEX_COLOR_PATTERN = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
function hexToRgb(hex) {
hex = hex.replace(SHORTHAND_HEX_COLOR_PATTERN, function (_, r, g, b) { return r + r + g + g + b + b; });
var result = hex.match(HEX_COLOR_PATTERN);
if (result) {
return {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16),
};
}
throw new Error('Playable.js: Color passed to theme should be in HEX format');
}
exports.default = hexToRgb;
//# sourceMappingURL=hexToRgb.js.map