moved isLight to utils

This commit is contained in:
Oliver Bryan
2026-01-12 02:42:57 +00:00
parent 296ef2ab0a
commit 30720c0e24
2 changed files with 13 additions and 13 deletions

View File

@@ -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,

View File

@@ -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;
};