fix(game-ui): 국가색 배경의 대비 전경색을 보완

This commit is contained in:
Hide_D committed 2026-08-19 14:19:06 +00:00
1 parent 78f75349fc
commit 8ed2b68878
19 files changed
+261 -123

No files matched your search

@@ -21,3 +21,17 @@ const lightTextBackgrounds = new Set([
export const legacyNationTextColor = (backgroundColor: string): '#FFFFFF' | '#000000' =>
lightTextBackgrounds.has(backgroundColor.toUpperCase()) ? '#FFFFFF' : '#000000';
/** Mirrors Ref `isBrightColor()`, used by Vue nation labels and message targets. */
export const isLegacyNationColorBright = (backgroundColor: string): boolean => {
const normalized = backgroundColor.trim().replace(/^#/u, '');
if (!/^[0-9a-f]{6}$/iu.test(normalized)) return false;
const red = Number.parseInt(normalized.slice(0, 2), 16);
const green = Number.parseInt(normalized.slice(2, 4), 16);
const blue = Number.parseInt(normalized.slice(4, 6), 16);
return red * 0.299 + green * 0.587 + blue * 0.114 > 140;
};
export const legacyLuminanceTextColor = (backgroundColor: string): '#000000' | '#FFFFFF' =>
isLegacyNationColorBright(backgroundColor) ? '#000000' : '#FFFFFF';