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

Automatically switch to dark high contrast if user prefers so (#19911)

Kabiru Mwenja8eca35873d80
diff --git a/frontend/src/app/core/setup/globals/theme-utils.ts b/frontend/src/app/core/setup/globals/theme-utils.ts
index 30865313315..164c73a2e2b 100644
--- a/frontend/src/app/core/setup/globals/theme-utils.ts
+++ b/frontend/src/app/core/setup/globals/theme-utils.ts
@@ -47,7 +47,7 @@ export class ThemeUtils {
switch (theme) {
case 'dark':
body.setAttribute('data-color-mode', 'dark');
- body.setAttribute('data-dark-theme', 'dark');
+ body.setAttribute('data-dark-theme', increaseContrast ? 'dark_high_contrast' : 'dark');
body.removeAttribute('data-light-theme');
break;
case 'light':
diff --git a/spec/features/my/interface_spec.rb b/spec/features/my/interface_spec.rb
index 6d4f694f0b2..6f33601d5fa 100644
--- a/spec/features/my/interface_spec.rb
+++ b/spec/features/my/interface_spec.rb
@@ -57,6 +57,11 @@ RSpec.describe "My account Interface settings",
expect(page).to have_css("body[data-color-mode='dark'][data-dark-theme='dark']")
+ select "Dark high contrast", from: "Colour mode"
+ click_on "Update look and feel"
+
+ expect(page).to have_css("body[data-color-mode='dark'][data-dark-theme='dark_high_contrast']")
+
select "Automatic (match OS colour mode)", from: "Colour mode"
click_on "Update look and feel"