Issue#2010 CSS media query prefers-dark-mode #4615
Closed
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.
Requirements
Description of the Change
When you change to dark mode in your OS, your mocha tests in the browser will follow suit.
Alternate Designs
There is a change needed in the javascript because the progress indicator canvas renders the 100% text in black.
I first tried using CSS only by changing the canvas background to a darker gray which made the text visible but the circle was then surrounded by a gray square in both light and dark modes this worked but looked tacky.
I then tried changing the text color in the javascript to #888 as a middle point between black and white which was ok.
In the end I used the existing two colors for the circle as outline and fill color for the text, which looks pretty good and is consitent with the existing code and colors.
I have tested this on Win10 Edge/Chrome switching the Color setting from control panel.
The file browser-color-scheme-demo.html is for reviewer's convenience to see it working.
Can be removed before final approval.
The files screenshot-mocha-*.png are for reviewer's convenience also, can be kept(moved somewhere) for adding to the documentation or removed before final approval.
I used the CSS prefers-color-scheme implementation because there was a consensus between @steve-taylor and @boneskull on the issue discussion #2747
Why should this be in core?
It's a change to the mocha.css directly and to the color of the rendered progress indicator.
Benefits
Possible Drawbacks
Any further color scheme changes will require dark mode values to be added and tested.
But there hasn't been such a change to the CSS since perhaps 2015 or sooner, the last time one of the color related CSS values changed:
Applicable issues
Enter any applicable Issues here.
Issue#2010
Mocha follows semantic versioning: http://semver.org
Is this a breaking change (major release)?
No
Is it an enhancement (minor release)?
Yes
Is it a bug fix, or does it not impact production code (patch release)?
Not a bug fix.