From b270882de71494d19f9f8528fd8df48dede564b2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 28 Nov 2024 16:01:14 +0100 Subject: [PATCH] Better is dark detection --- client/src/app/core/theme/theme.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts index dca51343b..6a702b738 100644 --- a/client/src/app/core/theme/theme.service.ts +++ b/client/src/app/core/theme/theme.service.ts @@ -268,14 +268,14 @@ export class ThemeService { } private isDarkTheme (computedStyle: CSSStyleDeclaration) { - const deprecatedFG = computedStyle.getPropertyValue('--mainForegroundColor') - const deprecatedBG = computedStyle.getPropertyValue('--mainBackgroundColor') + const fg = computedStyle.getPropertyValue('--fg') || computedStyle.getPropertyValue('--mainForegroundColor') + const bg = computedStyle.getPropertyValue('--bg') || computedStyle.getPropertyValue('--mainBackgroundColor') if (computedStyle.getPropertyValue('--is-dark') === '1') { return true - } else if (deprecatedFG && deprecatedBG) { + } else if (fg && bg) { try { - if (getLuminance(parse(deprecatedBG)) < getLuminance(parse(deprecatedFG))) { + if (getLuminance(parse(bg)) < getLuminance(parse(fg))) { return true } } catch (err) {