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

Issue#2010 CSS media query prefers-dark-mode #4615

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions browser-color-scheme-demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<!--

A demonstration of pass, pending, failing tests with syntax highlighting for test detail.

This file can be deleted from the PR once satisfied with the color scheme changes.

-->
<head>
<meta charset="utf-8" />
<title>Mocha Color Scheme Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="mocha.js"></script>
<script src="./node_modules/chai/chai.js"></script>
<script>
expect = chai.expect;
mocha.setup('bdd');
describe("failure suite", function () {
it("failing test", function () {
// This test has semantic init, keyword, comment, string, number
// to test mocha light/dark color scheme when viewing test detail
// in the browser.
var o = { _value: function (arg) { return void arg }}
var expected = 45;
expect(45).to.equal(expected);
expect(o._value('undef')).to.equal(void should);
expect(o._value('undef' /* an inline comment */)).to.equal(
void new Date(),
);
})
})
</script>
<script src="test/interfaces/bdd.spec.js"></script>
<script>
mocha.run();
</script>
</body>
</html>
13 changes: 9 additions & 4 deletions lib/browser/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,28 @@ Progress.prototype.draw = function(ctx) {
var angle = Math.PI * 2 * (percent / 100);
ctx.clearRect(0, 0, size, size);

// outer circle
// outer circle dark for LIGHT SCHEME
ctx.strokeStyle = '#9f9f9f';
ctx.beginPath();
ctx.arc(x, y, rad, 0, angle, false);
ctx.stroke();

// inner circle
// inner circle light for DARK SCHEME
ctx.strokeStyle = '#eee';
ctx.beginPath();
ctx.arc(x, y, rad - 1, 0, angle, true);
ctx.stroke();

// text
// text outline and fill for LIGHT/DARK SCHEME visibility
var text = this._text || (percent | 0) + '%';
var w = ctx.measureText(text).width;
var xText = x - w / 2 + 1;
var yText = y + fontSize / 2 - 1;

ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
ctx.strokeStyle = '#eee';
ctx.fillStyle = '#9f9f9f';
ctx.strokeText(text, xText, yText);
ctx.fillText(text, xText, yText);
} catch (ignore) {
// don't fail if we can't render progress
}
Expand Down
Loading