Skip to content

Fix: Light Styles Flash in Dark Mode #1063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025

Conversation

jesseaborden
Copy link
Contributor

Motivation:

When a user refreshes the page in dark mode, the light styles flash before being set to dark.

Modifications:

I moved the function call to set the theme from the DOMContentLoaded event to directly after the opening body tag. This avoids loading the light styles before the data attribute is set.

Result:

Light styles no longer flash on load in dark mode.

@shahmishal shahmishal merged commit c5a4976 into swiftlang:main Jun 5, 2025
3 checks passed
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