mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
moved isLight to utils
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user