From 30720c0e240a853ac58a890527e087b71724ee7a Mon Sep 17 00:00:00 2001 From: Oliver Bryan <04oliverbryan@gmail.com> Date: Mon, 12 Jan 2026 02:42:57 +0000 Subject: [PATCH] moved isLight to utils --- packages/frontend/src/components/status-tag.tsx | 14 +------------- packages/frontend/src/lib/utils.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/frontend/src/components/status-tag.tsx b/packages/frontend/src/components/status-tag.tsx index 81d9095..55767ed 100644 --- a/packages/frontend/src/components/status-tag.tsx +++ b/packages/frontend/src/components/status-tag.tsx @@ -1,17 +1,5 @@ import { DEFAULT_STATUS_COLOUR } from "@issue/shared"; -import { cn } from "@/lib/utils"; - -const DARK_TEXT_COLOUR = "#0a0a0a"; -const THRESHOLD = 0.6; - -const isLight = (hex: string): boolean => { - const num = Number.parseInt(hex.replace("#", ""), 16); - const r = (num >> 16) & 255; - const g = (num >> 8) & 255; - const b = num & 255; - const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255; - return luminance > THRESHOLD; -}; +import { cn, DARK_TEXT_COLOUR, isLight } from "@/lib/utils"; export default function StatusTag({ status, diff --git a/packages/frontend/src/lib/utils.ts b/packages/frontend/src/lib/utils.ts index 9f96bfe..81debf1 100644 --- a/packages/frontend/src/lib/utils.ts +++ b/packages/frontend/src/lib/utils.ts @@ -50,3 +50,15 @@ export function formatTime(ms: number): string { .toString() .padStart(2, "0")}`; } + +export const DARK_TEXT_COLOUR = "#0a0a0a"; +const THRESHOLD = 0.6; + +export const isLight = (hex: string): boolean => { + const num = Number.parseInt(hex.replace("#", ""), 16); + const r = (num >> 16) & 255; + const g = (num >> 8) & 255; + const b = num & 255; + const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255; + return luminance > THRESHOLD; +};