Skip to content

Fix :Add auto theme switching based on system preferences#262

Merged
rochacbruno merged 2 commits intorochacbruno:mainfrom
Keerthi421:main
Apr 24, 2025
Merged

Fix :Add auto theme switching based on system preferences#262
rochacbruno merged 2 commits intorochacbruno:mainfrom
Keerthi421:main

Conversation

@Keerthi421
Copy link
Copy Markdown
Contributor

Closes #261

This PR implements automatic theme switching for both the site and giscus comments based on the user's system preferences. The implementation:

  • Adds functionality to detect and respond to changes in system color scheme preference
  • Ensures giscus comments widget theme stays in sync with the site theme
  • Maintains compatibility with manual theme switching
  • Sets correct theme on initial page load

The code has been added to custom.js so users can easily implement this feature in their Marmite sites.

@Keerthi421 Keerthi421 changed the title Add auto theme switching based on system preferences Fix :Add auto theme switching based on system preferences Apr 24, 2025
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom.js must be empty by default, so the user has the freedom to add custom JS.

Can you move your implementation to the bottom of https://github.com/rochacbruno/marmite/blob/main/example/static/marmite.js ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rochacbruno Sure , I will do it

@rochacbruno rochacbruno merged commit 91b081f into rochacbruno:main Apr 24, 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.

Auto switch color scheme based on system theme

2 participants