Files
wehub-resource-sync e30e75b5d4
Code Quality / Oxlint + Oxfmt (push) Waiting to run
Code Quality / Template Sync (push) Waiting to run
Code Quality / Build Changed Packages (push) Waiting to run
Code Quality / Test Changed Packages (push) Waiting to run
Deploy Expo Example / Deploy Production (push) Waiting to run
Deploy Ink Example / Deploy Production (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.12) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.12) (push) Waiting to run
Deploy Shadcn Registry / Deploy Production (push) Waiting to run
Template Metrics / LOC + Bundle Size (push) Waiting to run
Changesets / Create Version PR (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:40:13 +08:00

39 lines
1003 B
TypeScript

import type {
BorderRadius,
FontSize,
MessageSpacing,
} from "@/components/builder/types";
export const BORDER_RADIUS_CLASS: Record<BorderRadius, string> = {
none: "rounded-none",
sm: "rounded-lg",
md: "rounded-xl",
lg: "rounded-2xl",
full: "rounded-3xl",
};
export const FONT_SIZE_CLASS: Record<FontSize, string> = {
"13px": "text-[13px]",
"14px": "text-sm",
"15px": "text-[15px]",
"16px": "text-base",
};
export const MESSAGE_SPACING_CLASS: Record<MessageSpacing, string> = {
compact: "py-2",
comfortable: "py-3",
spacious: "py-5",
};
/**
* Determines if a hex color is light (should use dark text) or dark (should use light text)
*/
export function isLightColor(hexColor: string): boolean {
const hex = hexColor.replace("#", "");
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 luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
return luminance > 0.5;
}