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

Set new default color for main menu

Henriette Dargee64c104543ed
diff --git a/app/views/custom_styles/_inline_css.erb b/app/views/custom_styles/_inline_css.erb
index bbc144db0ab..69c0e31a44c 100644
--- a/app/views/custom_styles/_inline_css.erb
+++ b/app/views/custom_styles/_inline_css.erb
@@ -48,9 +48,6 @@ See COPYRIGHT and LICENSE files for more details.
--main-menu-border-color: #d0d7de;
<% end %>
<% end %>
- <% if design_color.variable == "main-menu-bg-selected-background" %>
- --main-menu-selected-font-color: <%= design_color.contrasting_font_color %>;
- <% end %>
<% if design_color.variable == "primary-button-color" %>
--primary-button-color--major1: <%= design_color.darken 0.18 %>;
--primary-button-color--minor1: <%= design_color.lighten 0.8 %>;
diff --git a/db/migrate/20250627121119_change_default_main_menu_color.rb b/db/migrate/20250627121119_change_default_main_menu_color.rb
new file mode 100644
index 00000000000..f30a7d9fef5
--- /dev/null
+++ b/db/migrate/20250627121119_change_default_main_menu_color.rb
@@ -0,0 +1,47 @@
+# frozen_string_literal: true
+
+#
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+class ChangeDefaultMainMenuColor < ActiveRecord::Migration[8.0]
+ def up
+ update_color(OpenProject::CustomStyles::ColorThemes::DEPRECATED_MAIN_MENU_COLOR, "#FFFFFF")
+ end
+
+ def down
+ update_color("#FFFFFF", OpenProject::CustomStyles::ColorThemes::DEPRECATED_MAIN_MENU_COLOR)
+ end
+
+ def update_color(old, new)
+ execute <<-SQL.squish
+ UPDATE design_colors
+ SET hexcode = '#{new}'
+ WHERE variable = 'main-menu-bg-color' AND hexcode = '#{old}'
+ SQL
+ end
+end
diff --git a/frontend/src/global_styles/openproject/_variable_defaults.scss b/frontend/src/global_styles/openproject/_variable_defaults.scss
index 228b676f5a7..9573e756b6b 100644
--- a/frontend/src/global_styles/openproject/_variable_defaults.scss
+++ b/frontend/src/global_styles/openproject/_variable_defaults.scss
@@ -83,12 +83,12 @@
--main-menu-folded-width: 0px;
--main-menu-border-color: #EAEAEA;
--main-menu-border-width: 0px;
- --main-menu-item-height: 40px;
- --main-menu-bg-color: #333739;
+ --main-menu-item-height: 36px;
+ --main-menu-bg-color: #FFFFFF;
--main-menu-bg-selected-background: #175A8E;
- --main-menu-font-color: #FFFFFF;
+ --main-menu-font-color: var(--body-font-color);
--main-menu-resizer-color: var(--main-menu-border-color);
- --main-menu-selected-font-color: #FFFFFF;
+ --main-menu-selected-font-color: var(--main-menu-font-color);
--main-menu-font-size: 14px;
--main-menu-fieldset-header-color: #B0B2B3;
--main-menu-hover-border-color: transparent;
diff --git a/lib/open_project/custom_styles/color_themes.rb b/lib/open_project/custom_styles/color_themes.rb
index 44e7e5925d3..10d7a9a7a65 100644
--- a/lib/open_project/custom_styles/color_themes.rb
+++ b/lib/open_project/custom_styles/color_themes.rb
@@ -37,6 +37,7 @@ module OpenProject::CustomStyles
DEPRECATED_BIM_ALTERNATIVE_COLOR = "#349939".freeze
DEPRECATED_PRIMARY_DARK_COLOR = "#175A8E".freeze
DEPRECATED_LINK_COLOR = "#155282".freeze
+ DEPRECATED_MAIN_MENU_COLOR = "#333739".freeze
PRIMER_PRIMARY_BUTTON_COLOR = "#1F883D".freeze
ACCENT_COLOR = "#1A67A3".freeze
@@ -48,7 +49,7 @@ module OpenProject::CustomStyles
"accent-color" => ACCENT_COLOR,
"header-bg-color" => "#1A67A3",
"header-item-bg-hover-color" => "#175A8E",
- "main-menu-bg-color" => "#333739",
+ "main-menu-bg-color" => "#FFFFFF",
"main-menu-bg-selected-background" => "#175A8E",
}
},
diff --git a/spec/migrations/change_default_main_menu_color_spec.rb b/spec/migrations/change_default_main_menu_color_spec.rb
new file mode 100644
index 00000000000..8e4929d4a75
--- /dev/null
+++ b/spec/migrations/change_default_main_menu_color_spec.rb
@@ -0,0 +1,94 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require "spec_helper"
+require Rails.root.join("db/migrate/20250627121119_change_default_main_menu_color.rb")
+
+RSpec.describe ChangeDefaultMainMenuColor, type: :model do
+ context "when migrating up" do
+ context "with the standard color defined" do
+ before do
+ create(:design_color, variable: "main-menu-bg-color", hexcode: OpenProject::CustomStyles::ColorThemes::DEPRECATED_MAIN_MENU_COLOR)
+ end
+
+ # Silencing migration logs, since we are not interested in that during testing
+ subject { ActiveRecord::Migration.suppress_messages { described_class.new.up } }
+
+ it "replaces the value'" do
+ expect { subject }.not_to change(DesignColor, :count)
+ expect(DesignColor.find_by(variable: "main-menu-bg-color").hexcode).to eq "#FFFFFF"
+ end
+ end
+
+ context "with a custom color defined" do
+ before do
+ create(:design_color, variable: "main-menu-bg-color", hexcode: "#ABC123")
+ end
+
+ # Silencing migration logs, since we are not interested in that during testing
+ subject { ActiveRecord::Migration.suppress_messages { described_class.new.up } }
+
+ it "keeps the custom the value'" do
+ expect { subject }.not_to change(DesignColor, :count)
+ expect(DesignColor.find_by(variable: "main-menu-bg-color").hexcode).to eq "#ABC123"
+ end
+ end
+ end
+
+ context "when migrating down" do
+ context "with the standard color defined" do
+ before do
+ create(:design_color, variable: "main-menu-bg-color", hexcode: "#FFFFFF")
+ end
+
+ # Silencing migration logs, since we are not interested in that during testing
+ subject { ActiveRecord::Migration.suppress_messages { described_class.new.down } }
+
+ it "replaces the value'" do
+ expect { subject }.not_to change(DesignColor, :count)
+ expect(DesignColor.find_by(variable: "main-menu-bg-color").hexcode).to eq OpenProject::CustomStyles::ColorThemes::DEPRECATED_MAIN_MENU_COLOR
+ end
+ end
+
+ context "with a custom color defined" do
+ before do
+ create(:design_color, variable: "main-menu-bg-color", hexcode: "#ABC123")
+ end
+
+ # Silencing migration logs, since we are not interested in that during testing
+ subject { ActiveRecord::Migration.suppress_messages { described_class.new.down } }
+
+ it "keeps the custom the value'" do
+ expect { subject }.not_to change(DesignColor, :count)
+ expect(DesignColor.find_by(variable: "main-menu-bg-color").hexcode).to eq "#ABC123"
+ end
+ end
+ end
+end