unified-video-framework
Version:
Cross-platform video player framework supporting iOS, Android, Web, Smart TVs (Samsung/LG), Roku, and more
15 lines • 512 B
JavaScript
export function hexToRgb(hex) {
const cleanHex = hex.replace('#', '');
const r = parseInt(cleanHex.substring(0, 2), 16);
const g = parseInt(cleanHex.substring(2, 4), 16);
const b = parseInt(cleanHex.substring(4, 6), 16);
return { r, g, b };
}
export function hexToRgba(hex, opacity) {
const { r, g, b } = hexToRgb(hex);
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
}
export function isValidHex(hex) {
return /^#?[0-9A-Fa-f]{6}$/.test(hex);
}
//# sourceMappingURL=ColorUtils.js.map