18 lines
473 B
TypeScript
18 lines
473 B
TypeScript
import { type ClassValue, clsx } from "clsx"
|
|
import { twMerge } from "tailwind-merge"
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
export const hexToRGB = (hex: any, alpha?: number): any => {
|
|
const r = parseInt(hex.slice(1, 3), 16);
|
|
const g = parseInt(hex.slice(3, 5), 16);
|
|
const b = parseInt(hex.slice(5, 7), 16);
|
|
|
|
if (alpha) {
|
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
} else {
|
|
return `rgb(${r}, ${g}, ${b})`;
|
|
}
|
|
}; |