Better is dark detection

This commit is contained in:
Chocobozzz 2024-11-28 16:01:14 +01:00
parent 9ce2b76e0e
commit b270882de7
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 4 additions and 4 deletions

View File

@ -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) {