Better is dark detection
This commit is contained in:
parent
9ce2b76e0e
commit
b270882de7
|
@ -268,14 +268,14 @@ export class ThemeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private isDarkTheme (computedStyle: CSSStyleDeclaration) {
|
private isDarkTheme (computedStyle: CSSStyleDeclaration) {
|
||||||
const deprecatedFG = computedStyle.getPropertyValue('--mainForegroundColor')
|
const fg = computedStyle.getPropertyValue('--fg') || computedStyle.getPropertyValue('--mainForegroundColor')
|
||||||
const deprecatedBG = computedStyle.getPropertyValue('--mainBackgroundColor')
|
const bg = computedStyle.getPropertyValue('--bg') || computedStyle.getPropertyValue('--mainBackgroundColor')
|
||||||
|
|
||||||
if (computedStyle.getPropertyValue('--is-dark') === '1') {
|
if (computedStyle.getPropertyValue('--is-dark') === '1') {
|
||||||
return true
|
return true
|
||||||
} else if (deprecatedFG && deprecatedBG) {
|
} else if (fg && bg) {
|
||||||
try {
|
try {
|
||||||
if (getLuminance(parse(deprecatedBG)) < getLuminance(parse(deprecatedFG))) {
|
if (getLuminance(parse(bg)) < getLuminance(parse(fg))) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue