aboutsummaryrefslogtreecommitdiff
path: root/ext/js/app/theme-controller.js
diff options
context:
space:
mode:
authorKuuuube <61125188+Kuuuube@users.noreply.github.com>2024-06-18 20:18:43 -0400
committerGitHub <noreply@github.com>2024-06-19 00:18:43 +0000
commit451bcab01fd591ec54b63af0fc7084dc9f37928b (patch)
tree5b7ae78d7187c77f4b12bf377524e837e9b24606 /ext/js/app/theme-controller.js
parentc002e585fcbfc89b2c345a10c0663336f31442af (diff)
Add auto option to body theme (#1086)
* Add auto option to body theme * Fix firefox bug where themes do not set correctly in settings due to getOptions failing
Diffstat (limited to 'ext/js/app/theme-controller.js')
-rw-r--r--ext/js/app/theme-controller.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/js/app/theme-controller.js b/ext/js/app/theme-controller.js
index c12f1113..44ff723b 100644
--- a/ext/js/app/theme-controller.js
+++ b/ext/js/app/theme-controller.js
@@ -27,14 +27,16 @@ export class ThemeController {
constructor(element) {
/** @type {?HTMLElement} */
this._element = element;
- /** @type {'light'|'dark'|'browser'} */
- this._theme = 'light';
/** @type {'light'|'dark'|'browser'|'site'} */
- this._outerTheme = 'light';
+ this._theme = 'site';
+ /** @type {'light'|'dark'|'browser'|'site'} */
+ this._outerTheme = 'site';
/** @type {?('dark'|'light')} */
this._siteTheme = null;
/** @type {'dark'|'light'} */
this._browserTheme = 'light';
+ /** @type {boolean} */
+ this.siteOverride = false;
}
/**
@@ -55,7 +57,7 @@ export class ThemeController {
/**
* Gets the main theme for the content.
- * @type {'light'|'dark'|'browser'}
+ * @type {'light'|'dark'|'browser'|'site'}
*/
get theme() {
return this._theme;
@@ -63,7 +65,7 @@ export class ThemeController {
/**
* Sets the main theme for the content.
- * @param {'light'|'dark'|'browser'} value The theme value to assign.
+ * @param {'light'|'dark'|'browser'|'site'} value The theme value to assign.
*/
set theme(value) {
this._theme = value;
@@ -171,7 +173,7 @@ export class ThemeController {
*/
_resolveThemeValue(theme, computedSiteTheme) {
switch (theme) {
- case 'site': return computedSiteTheme;
+ case 'site': return this.siteOverride ? this._browserTheme : computedSiteTheme;
case 'browser': return this._browserTheme;
default: return theme;
}