Skip to content

Commit b2cec1c

Browse files
authored
Merge pull request #253 from zbynek/dark-theme
[JENKINS-71997] Improve support for dark theme
2 parents dd6b58d + 19427a5 commit b2cec1c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/main/resources/io/jenkins/plugins/bootstrap5.jelly

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Use it like <st:adjunct includes="io.jenkins.plugins.bootstrap5"/>
1515
<script type="text/javascript" src="${resURL}/plugin/bootstrap5-api/js/popper.min.js"/>
1616
<script type="text/javascript" src="${resURL}/plugin/bootstrap5-api/js/bootstrap.min.js"/>
1717
<script type="text/javascript" src="${resURL}/plugin/bootstrap5-api/js/no-prototype.js"/>
18+
<script type="text/javascript" src="${resURL}/plugin/bootstrap5-api/js/theme-support.js"/>
1819

1920
<script>
2021
const bootstrap5 = bootstrap;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if (window.getThemeManagerProperty) {
2+
const setBsTheme = () => document.body.dataset['bsTheme'] = getThemeManagerProperty('bootstrap', 'theme');
3+
setBsTheme();
4+
5+
if (window.isSystemRespectingTheme) {
6+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
7+
setBsTheme()
8+
});
9+
}
10+
}

0 commit comments

Comments
 (0)