Skip to content

Ensure theme switches to preferred colour scheme on first load#2520

Open
JakeYallop wants to merge 1 commit into
gchq:masterfrom
JakeYallop:dark-mode-fix
Open

Ensure theme switches to preferred colour scheme on first load#2520
JakeYallop wants to merge 1 commit into
gchq:masterfrom
JakeYallop:dark-mode-fix

Conversation

@JakeYallop

@JakeYallop JakeYallop commented Jun 5, 2026

Copy link
Copy Markdown

Description
Currently opening the page for the first time does not correctly apply the users preferred colour scheme.

In OptionsWaiter, we do this to apply the theme:

applyPreferredColorScheme() {
const themeFromStorage = this.app?.options?.theme;
let theme = themeFromStorage;
if (!theme) {
theme = this.getPreferredColorScheme();
}
this.changeTheme(theme);
}

However, themeFromStorage is already set to "classic" at this point, assigned here:

this.options = Object.assign({}, defaultOptions);

The fix is set the default theme to undefined and let it be set from either localStorage or getPreferredColorScheme().

Related issues: #1921, #1901

AI disclosure
No AI was used in the creation of this pull request.

@CLAassistant

CLAassistant commented Jun 5, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants