Skip to content

Commit

Permalink
Merge pull request #765 from jenkinsci/refresh-chart-on-dark-mode-event
Browse files Browse the repository at this point in the history
Redraw the trend charts when user changes color theme (dark/light mode)
  • Loading branch information
uhafner committed Sep 19, 2023
2 parents 6959c42 + b29d550 commit 15ce96e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugin/src/main/webapp/js/view-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,16 @@ const CoverageChartGenerator = function ($) {
redrawCharts();
});

if (window.getThemeManagerProperty && window.isSystemRespectingTheme) {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
redrawCharts();

viewProxy.getOverview(function (t) {
createOverview(t.responseObject(), 'coverage-overview');
});
});
}

$(document).ready(function () {
initializeSourceCodeSelection('absolute-coverage');
initializeSourceCodeSelection('change-coverage');
Expand Down

0 comments on commit 15ce96e

Please sign in to comment.