Skip to content
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

Add a config option to disable theme toggle buttons to automatically use browser settings #1697

Merged
merged 10 commits into from
Apr 29, 2024

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Apr 28, 2024

You can now disable the theme toggle buttons by setting theme_toggle_buttons to false in config/hyde.php.

If the Feature::Darkmode setting is disabled in the features array in the same file, this won't do anything, but if darkmode is enabled setting the theme toggle buttons setting to false they will not show up in the app layout nor the documentation layout; instead the appropriate color scheme will be automatically applied based on the browser system settings.

Copy link

codecov bot commented Apr 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.97%. Comparing base (4f4c67c) to head (1dc8fe0).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1697   +/-   ##
=========================================
  Coverage     99.97%   99.97%           
- Complexity     1744     1746    +2     
=========================================
  Files           181      181           
  Lines          4663     4665    +2     
=========================================
+ Hits           4662     4664    +2     
  Misses            1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caendesilva caendesilva force-pushed the add-automatic-dark-mode-option branch from f4ac556 to bec8791 Compare April 28, 2024 19:13
@caendesilva caendesilva force-pushed the add-automatic-dark-mode-option branch from d87eb26 to 0cacc81 Compare April 28, 2024 19:54
@caendesilva caendesilva changed the title Add automatic dark mode feature by adding a way to disable dark mode buttons Add a config option to disable theme toggle buttons, leaving it to user preferences Apr 29, 2024
@caendesilva caendesilva temporarily deployed to pr-documentation-1697 April 29, 2024 10:58 — with GitHub Actions Inactive
@caendesilva caendesilva changed the title Add a config option to disable theme toggle buttons, leaving it to user preferences Add a config option to disable theme toggle buttons to automatically use browser settings Apr 29, 2024
@caendesilva
Copy link
Member Author

Note that if this is enabled for an existing site, if a user has previously used the toggle buttons they may still have a local storage setting that will take precedence. Clearing this would require changing the storage key (which we may want to do in a future release to prefix it with hyde) but we can't do that here as it's a breaking change.

@caendesilva caendesilva force-pushed the add-automatic-dark-mode-option branch from 71d0f06 to f449151 Compare April 29, 2024 11:04
@caendesilva caendesilva temporarily deployed to pr-documentation-1697 April 29, 2024 11:04 — with GitHub Actions Inactive
@caendesilva caendesilva marked this pull request as ready for review April 29, 2024 11:05
@caendesilva caendesilva merged commit ef46df7 into master Apr 29, 2024
22 checks passed
@caendesilva caendesilva deleted the add-automatic-dark-mode-option branch April 29, 2024 11:07
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.

Add "automatic" dark mode option to just use browser preference without toggle button?
1 participant