From 9541e0c32e95ae2f47b2cdda5184cc18ea7838cb Mon Sep 17 00:00:00 2001 From: Rupin Khandelwal Date: Mon, 11 Jul 2022 21:20:57 +0000 Subject: [PATCH] updated Labels for different themes --- .../web/components/elements/LabelChip.tsx | 28 +++++++++++++------ .../elements/LabelColorDropdown.tsx | 24 ++-------------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/packages/web/components/elements/LabelChip.tsx b/packages/web/components/elements/LabelChip.tsx index 412915a00..cfd9011d9 100644 --- a/packages/web/components/elements/LabelChip.tsx +++ b/packages/web/components/elements/LabelChip.tsx @@ -1,7 +1,8 @@ +import { getLuminance } from 'color2k' import { useRouter } from 'next/router' import { Button } from './Button' import { SpanBox } from './LayoutPrimitives' - +import { isDarkTheme } from '../../lib/themeUpdater' type LabelChipProps = { text: string color: string // expected to be a RGB hex color string @@ -9,6 +10,7 @@ type LabelChipProps = { export function LabelChip(props: LabelChipProps): JSX.Element { const router = useRouter() + const hexToRgb = (hex: string) => { const bigint = parseInt(hex.substring(1), 16) const r = (bigint >> 16) & 255 @@ -17,19 +19,27 @@ export function LabelChip(props: LabelChipProps): JSX.Element { return [r, g, b] } + const isDarkMode = isDarkTheme() + const luminance = getLuminance(props.color) const color = hexToRgb(props.color) - return ( -