mirror of
https://github.com/warmbly/warmbly.git
synced 2026-09-09 08:03:38 +00:00
Add the launch dialog, campaign folder controls, completed status filtering, folder chips, and shared UI affordances for campaign organization.
18 lines
756 B
TypeScript
18 lines
756 B
TypeScript
import { clsx, type ClassValue } from "clsx"
|
|
import { twMerge } from "tailwind-merge"
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
// Turn a "#rrggbb" (or "#rgb") hex into a translucent rgba() string — handy for
|
|
// tinting a UI surface with a user-chosen color. Falls back to slate on a
|
|
// malformed hex so callers never render an invalid background.
|
|
export function hexToRgba(hex: string, alpha: number): string {
|
|
const h = (hex ?? "").replace("#", "")
|
|
const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h
|
|
const n = parseInt(full, 16)
|
|
if (full.length !== 6 || Number.isNaN(n)) return `rgba(100,116,139,${alpha})`
|
|
return `rgba(${(n >> 16) & 255},${(n >> 8) & 255},${n & 255},${alpha})`
|
|
}
|