Skip to content

Commit

Permalink
feat(HTML reporter): Dark mode support 🌑 (#2590)
Browse files Browse the repository at this point in the history
  • Loading branch information
wijtserekker committed Oct 29, 2020
1 parent 4a510a6 commit ca9a513
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/package.json
Expand Up @@ -71,7 +71,7 @@
"log4js": "~6.2.1",
"minimatch": "~3.0.4",
"mkdirp": "~1.0.3",
"mutation-testing-elements": "~1.4.0",
"mutation-testing-elements": "~1.4.1",
"mutation-testing-metrics": "~1.4.0",
"npm-run-path": "~4.0.1",
"progress": "~2.0.0",
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/reporters/html/templates/index.html
Expand Up @@ -13,6 +13,14 @@
Your browser doesn't support <a href="https://caniuse.com/#search=custom%20elements">custom elements</a>.
Please use a latest version of an evergreen browser (Firefox, Chrome, Safari, Opera, etc).
</mutation-test-report-app>
<script>
const app = document.getElementsByTagName('mutation-test-report-app').item(0)
function updateTheme() {
document.body.style.backgroundColor = app.theme === 'dark' ? '#222' : '#fff';
}
app.addEventListener('theme-changed', updateTheme);
updateTheme();
</script>
<script src="bind-mutation-test-report.js"></script>
</body>

Expand Down

0 comments on commit ca9a513

Please sign in to comment.