Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

implementation/66460 Automatically sync the contrast mode with the OS preference change (#19831)

Kabiru Mwenja2343cc019831
diff --git a/frontend/src/stimulus/controllers/auto-theme-switcher.controller.ts b/frontend/src/stimulus/controllers/auto-theme-switcher.controller.ts
index c7131236a19..d87f1ff2729 100644
--- a/frontend/src/stimulus/controllers/auto-theme-switcher.controller.ts
+++ b/frontend/src/stimulus/controllers/auto-theme-switcher.controller.ts
@@ -44,6 +44,7 @@ export default class AutoThemeSwitcher extends Controller {
useMatchMedia(this, {
mediaQueries: {
lightMode: '(prefers-color-scheme: light)',
+ highContrastMode: '(prefers-contrast: more)',
},
});
}
@@ -55,4 +56,8 @@ export default class AutoThemeSwitcher extends Controller {
notLightMode():void {
window.OpenProject.theme.applyThemeToBody('dark');
}
+
+ highContrastModeChanged():void {
+ window.OpenProject.theme.applySystemThemeImmediately();
+ }
}