Add support for automatic CSS dark mode #127
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change uses the CSS color-scheme property (widely available as of 2022 according to MDN 1) to opt FAExport's web interface in to automatic CSS light and dark mode. This change should be invisible to browsers that do not support
color-scheme
, since it has no other effects, and browsers that do not support the property will continue to display FAExport in light mode, as they always have.In order to make the navigation links visible in dark mode, I also changed the text color from
#000000
toCanvasText
, which selects the default text color. This color name has been available since 2015, according to MDN 2. If you'd prefer, I can add theCanvasText
line after the original#000000
line, so that browsers which do not support the system-color data type will still display the links in black text. (That shouldn't be an issue for dark mode, since a browser that doesn't support system-color will almost certainly not supportcolor-scheme
:P)Motivation: I got flashbanged by FAExport at 2:30 am and realized that I could fix that :3
Footnotes
https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme ↩
https://developer.mozilla.org/en-US/docs/Web/CSS/system-color ↩