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

Use separate high contrast logo

Oliver Günther80a11335a952
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index 4094618a33a..246abb7af12 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -127,6 +127,10 @@ class UserPreference < ApplicationRecord
super.presence || Setting.user_default_theme
end
+ def high_contrast_theme?
+ theme.end_with?('high_contrast')
+ end
+
def time_zone
super.presence || Setting.user_default_timezone.presence
end
diff --git a/app/views/custom_styles/_inline_css_logo.erb b/app/views/custom_styles/_inline_css_logo.erb
index 0c59172ba56..8059da75e50 100644
--- a/app/views/custom_styles/_inline_css_logo.erb
+++ b/app/views/custom_styles/_inline_css_logo.erb
@@ -29,19 +29,25 @@ See COPYRIGHT and LICENSE files for more details.
<% cache(CustomStyle.current) do %>
<style type="text/css">
- <% logo_url = asset_path("logo_openproject_white_big.png") %>
- <% if apply_custom_styles? %>
- <%
- if CustomStyle.current.logo.present?
- logo_url = custom_style_logo_path(digest: CustomStyle.current.digest, filename: CustomStyle.current.logo_identifier)
- elsif CustomStyle.current.theme_logo.present?
- logo_url = asset_path(CustomStyle.current.theme_logo)
- end
- %>
- <% end %>
+ <%
+ logo_url = asset_path("logo_openproject_white_big.png")
+ high_contrast_logo_url = asset_path("logo_openproject.png")
+
+ if apply_custom_styles?
+ if CustomStyle.current.logo.present?
+ logo_url = custom_style_logo_path(digest: CustomStyle.current.digest, filename: CustomStyle.current.logo_identifier)
+ elsif CustomStyle.current.theme_logo.present?
+ logo_url = asset_path(CustomStyle.current.theme_logo)
+ end
+ end
+ %>
.op-logo--link {
background-image: url(<%= logo_url %>);
}
+
+ .op-logo--link_high_contrast {
+ background-image: url(<%= high_contrast_logo_url %>);
+ }
</style>
<% end %>
diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb
index 60d1b6a4c15..7552fffacfb 100644
--- a/lib/redmine/menu_manager/top_menu_helper.rb
+++ b/lib/redmine/menu_manager/top_menu_helper.rb
@@ -45,7 +45,10 @@ module Redmine::MenuManager::TopMenuHelper
def render_top_menu_center
content_tag :div, class: 'op-logo' do
- link_to(I18n.t('label_home'), configurable_home_url, class: 'op-logo--link')
+ mode_class = User.current.pref.high_contrast_theme? ? 'op-logo--link_high_contrast' : ''
+ link_to(I18n.t('label_home'),
+ configurable_home_url,
+ class: "op-logo--link #{mode_class}")
end
end