Skip to content

Commit

Permalink
Merge pull request #303 from jenkinsci/refresh-charts-on-dark-mode-event
Browse files Browse the repository at this point in the history
Refresh trend charts when system dark mode settings fire an event
  • Loading branch information
uhafner authored Sep 16, 2023
2 parents 5552ab8 + 63d6269 commit 3a10234
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/webapp/js/echarts-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,11 @@ const echartsJenkinsApi = {
document.addEventListener(redrawChartEvent, function () {
renderAsynchronously(chart);
});
if (window.getThemeManagerProperty && window.isSystemRespectingTheme) {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
renderAsynchronously(chart);
});
}

getConfigurationDialog().addEventListener("hidden.bs.modal", function () {
const configuration = echartsJenkinsApi.readConfiguration(localStorageId);
Expand Down

0 comments on commit 3a10234

Please sign in to comment.