Move theme and color scheme setting to the documentElement

In theory this is more correct and could help with issues of
color-scheme not being set correctly in the reader on iOS and
Android.
This commit is contained in:
Jackson Harper
2023-05-02 16:01:13 +08:00
parent a1952fb9e7
commit 0a147b744d
6 changed files with 9 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -116,6 +116,7 @@ struct WebReader: PlatformViewRepresentable {
(webView as? OmnivoreWebView)?.updateJustifyText()
webView.backgroundColor = UIColor(ThemeManager.currentBgColor)
webView.tintColor = UIColor.black
webView.underPageBackgroundColor = UIColor(ThemeManager.currentBgColor)
webView.scrollView.backgroundColor = UIColor(ThemeManager.currentBgColor)
webView.scrollView.indicatorStyle = ThemeManager.currentTheme.isDark ?

File diff suppressed because one or more lines are too long

View File

@ -288,6 +288,9 @@ const blackThemeSpec = {
}
const sepiaThemeSpec = {
colorScheme: {
colorScheme: 'light',
},
colors: {
readerBg: '#FBF0D9',
readerFont: '#5F4B32',

View File

@ -44,7 +44,7 @@ export function updateThemeLocally(themeId: string): void {
window.localStorage.setItem(themeKey, themeId)
}
document.body.classList.remove(
document.documentElement.classList.remove(
...Object.keys(LEGACY_THEMES),
sepiaTheme,
darkTheme,
@ -52,7 +52,7 @@ export function updateThemeLocally(themeId: string): void {
blackTheme,
...Object.keys(ThemeId)
)
document.body.classList.add(getTheme(themeId))
document.documentElement.classList.add(getTheme(themeId))
}
export function currentThemeName(): string {

View File

@ -3,7 +3,7 @@
}
:root {
color-scheme: var(--colorScheme-colorScheme);
color-scheme: light;
}
.speakingSection {