zwbetz-gh / cupper-hugo-theme

An accessibility-friendly Hugo theme, ported from the original Cupper project.
https://cupper-hugo-theme.netlify.app/
MIT License
301 stars 190 forks source link

Add default dark theme for modern browsers #56

Closed danielfdickinson closed 3 years ago

danielfdickinson commented 3 years ago

This version is based on the DOM specification used by Firefox, Chrome, and the new Edge. Since it is standards compliant it should work on modern browsers, but dark mode won't be available on IE11 and maybe the old Edge. I have avoided the screen flash on loading the page, and toggling from dark to light (or vice versa) both when dark is default and when light is default.

Hope you like it!

That is toggling works …

zwbetz-gh commented 3 years ago

Hey Daniel,

Want you to know that I've seen your PR and plan to review it. My schedule has just been hectic lately.

On Mon, Aug 9, 2021 at 11:56 PM Daniel F. Dickinson < @.***> wrote:

This version is based on the DOM specification used by Firefox, Chrome, and the new Edge. Since it is standards compliant it should work on modern browsers, but dark mode won't be available on IE11 and maybe the old Edge. I have avoided the screen flash on loading the page, and toggling from dark to light (or vice versa) both when dark is default and when light is default.

Hope you like it!

You can view, comment on, or merge this pull request online at:

https://github.com/zwbetz-gh/cupper-hugo-theme/pull/56 Commit Summary

  • Add default dark theme for modern browsers

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zwbetz-gh/cupper-hugo-theme/pull/56, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI4WX7FZFZC4BX7SEW74NYLT4CWPZANCNFSM5B3LLELA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

zwbetz-gh commented 3 years ago

Update exampleSite/config.yaml and add

defaultDarkTheme: false
zwbetz-gh commented 3 years ago

That wording looks good.

On Mon, Aug 16, 2021 at 9:12 PM Daniel F. Dickinson < @.***> wrote:

@.**** commented on this pull request.

In README.md https://github.com/zwbetz-gh/cupper-hugo-theme/pull/56#discussion_r689982522 :

@@ -105,6 +105,17 @@ You can provide an optional list of custom JS files, which must be placed inside

See the example site config file for sample usage.

+## Default to Dark Theme

So far, I've got the following text. Please let me know of any edits you'd like.

Note that the default of light or dark theme only applies to the first visit to a site using this theme. Once the site is visited the choice of dark or light theme is stored in 'local storage' in the browser.

To reset to a 'first visit' scenario (e.g. for testing), one needs to either browse in private mode (aka Incognito/InPrivate/etc) or delete 'local storage' for this site. The easiest way to do that, but which affects other sites as well, is to use the 'Clear History' feature of the browser.

Check your browser's help or documentation for details.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zwbetz-gh/cupper-hugo-theme/pull/56#discussion_r689982522, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI4WX7AD4RJURMHG6FUVA6DT5HAQLANCNFSM5B3LLELA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

danielfdickinson commented 3 years ago

I can squash if you wish, or do you prefer to do that?

zwbetz-gh commented 3 years ago

No worries. Once I merge, I will squash.

On Mon, Aug 16, 2021 at 9:33 PM Daniel F. Dickinson < @.***> wrote:

I can squash if you wish, or do you prefer to do that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zwbetz-gh/cupper-hugo-theme/pull/56#issuecomment-899947124, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI4WX7FHOX7KWF7RMDCDFMDT5HC6XANCNFSM5B3LLELA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .