Create professional demos and 3D mockups in seconds, directly in your browser
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export function hexToRgba(hex: string, opacity: number = 100): string {
hex = hex.replace("#", "");
if (hex.length === 3) {
hex = hex.split("").map(char => char + char).join("");
}
const r = parseInt(hex.substring(0, 2), 16);
const g = parseInt(hex.substring(2, 4), 16);
const b = parseInt(hex.substring(4, 6), 16);
const alpha = opacity / 100;
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}