add support for 'prefers-color-scheme' save our eyes @ night
Please consider changing the world of github pages and other consumers of template to save our vision. (-:
@pdmosses could I get your opinion on how this impacts your Combination PR + the general dark mode work that you've done?
@mattxwang the Combination PR #578 doesn't include automatic switching because #464 and #560 are alternative ways of fixing issue #234, and I didn't know which would finally be merged.
In contrast to #464 and #560, the present PR doesn't update the color scheme on open pages until they are manually reloaded, I think? It's also not configurable.
Perhaps issue #234 is the best place to discuss the pros and cons of the alternative PRs.
It is not configurable. Yes. Changes are automatic. Although IE will not get any styling (-: It also does not take into account that users can use their own "template"
I proposed this as a way.
I think that absence of window.matchMedia might be a feature detection fallback to this technique to support the non-evergreen browsers instead to append a style tag to head with no media-query.
Okay, I think that this is
- part of a larger discussion
- not likely to be merged into v0.4.0, until we decide on the discussion
I'm going to label this PR as needs discussion. I'm not particularly well-versed in how JTD handles dark mode and will need to do a bit more reading; if another maintainer wants to take point on leading the color theme discussion, that would be great.
Thoughts: 2 themes are there since the time when browsers did not support relative media query So site author could decide on the theme. Most of the sites using JTD are using one of default themes.. Providing auto-switching theme as a default and explaining in the docs how to force ones own theme is a better solution because out of the box most sites (that use defaults) will care about night mode..
I tried running this PR in my fork and noticed that it is necessary to modify this script
In https://github.com/simonebortolin/just-the-docs/tree/prefers-color-scheme
I have made a fix for the script that after the change in question at this PR no longer works
Left a comment in https://github.com/just-the-docs/just-the-docs/issues/234 explaining what's necessary to get this in a mergeable state! Happy to have anybody take it on, and I can review it, etc.