Skip to content

Add theme-init script to set dark mode based on user preference or system setting#12

Merged
reenatoteixeira merged 1 commit intostagefrom
feat/theme-init
Mar 26, 2026
Merged

Add theme-init script to set dark mode based on user preference or system setting#12
reenatoteixeira merged 1 commit intostagefrom
feat/theme-init

Conversation

@reenatoteixeira
Copy link
Copy Markdown
Member

This pull request adds support for initializing the website's theme (light or dark mode) based on the user's preference or system settings. The theme is set as early as possible to prevent unwanted flashes of the wrong theme during page load.

Theme initialization:

  • Added a new script, public/theme-init.js, which checks the user's saved theme in localStorage or falls back to the system's prefers-color-scheme setting, and applies the appropriate theme class to the document.
  • Included the theme-init.js script at the top of the <head> in index.html to ensure the theme is set before the page renders.

@reenatoteixeira reenatoteixeira self-assigned this Mar 26, 2026
@reenatoteixeira reenatoteixeira added the enhancement New feature or request label Mar 26, 2026
@reenatoteixeira reenatoteixeira merged commit 504b3ad into stage Mar 26, 2026
2 checks passed
@reenatoteixeira reenatoteixeira deleted the feat/theme-init branch March 26, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant