include/vcl/settings.hxx | 9 +++++ sfx2/source/dialog/infobar.cxx | 12 +++---- vcl/source/app/salvtables.cxx | 8 +++-- vcl/source/app/settings.cxx | 53 +++++++++++++++++++++++++++++++++- vcl/unx/gtk3/gtkinst.cxx | 4 +- vcl/unx/gtk3/salnativewidgets-gtk.cxx | 5 --- 6 files changed, 75 insertions(+), 16 deletions(-)
New commits: commit d7fd378b533c42f51d1d363f5da30b1fa1281f67 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Fri Mar 22 12:58:07 2024 +0100 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Sat Mar 23 08:02:18 2024 +0100 Harmonization of warning and error colors * hard-coded colors from infobar moved to settings * weld::LabelType::Warning and ::Error uses these colors * gtk3 native configuration removed Change-Id: Ia80584e9267b8385f7f6b25322f5a85a2570af68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165161 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index 0787fe98b6cc..e21091385bc7 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -353,6 +353,15 @@ public: void SetWarningColor( const Color& rColor ); const Color& GetWarningColor() const; + void SetWarningTextColor( const Color& rColor ); + const Color& GetWarningTextColor() const; + + void SetErrorColor( const Color& rColor ); + const Color& GetErrorColor() const; + + void SetErrorTextColor( const Color& rColor ); + const Color& GetErrorTextColor() const; + void SetHelpColor( const Color& rColor ); const Color& GetHelpColor() const; diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 38a510a2589c..26dfc0af26c0 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -44,6 +44,8 @@ void GetInfoBarColors(InfobarType ibType, BColor& rBackgroundColor, BColor& rFor { rMessageColor = basegfx::BColor(0.0, 0.0, 0.0); + const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); + switch (ibType) { case InfobarType::INFO: // blue; #004785/0,71,133; #BDE5F8/189,229,248 @@ -55,17 +57,15 @@ void GetInfoBarColors(InfobarType ibType, BColor& rBackgroundColor, BColor& rFor rForegroundColor = basegfx::BColor(0.196, 0.333, 0.047); break; case InfobarType::WARNING: // orange; #704300/112,67,0; #FEEFB3/254,239,179 - rBackgroundColor = basegfx::BColor(0.996, 0.937, 0.702); - rForegroundColor = basegfx::BColor(0.439, 0.263, 0.0); + rBackgroundColor = rSettings.GetWarningColor().getBColor(); + rForegroundColor = rSettings.GetWarningTextColor().getBColor(); break; case InfobarType::DANGER: // red; #7A0006/122,0,6; #FFBABA/255,186,186 - rBackgroundColor = basegfx::BColor(1.0, 0.729, 0.729); - rForegroundColor = basegfx::BColor(0.478, 0.0, 0.024); + rBackgroundColor = rSettings.GetErrorColor().getBColor(); + rForegroundColor = rSettings.GetErrorTextColor().getBColor(); break; } - //remove this? - const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); if (rSettings.GetHighContrastMode()) { rBackgroundColor = rSettings.GetLightColor().getBColor(); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 4469978be626..3f007783498d 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5949,14 +5949,16 @@ void SalInstanceLabel::set_label_type(weld::LabelType eType) m_xLabel->SetControlBackground(); break; case weld::LabelType::Warning: - m_xLabel->SetControlForeground(); + m_xLabel->SetControlForeground( + m_xLabel->GetSettings().GetStyleSettings().GetWarningTextColor()); m_xLabel->SetControlBackground( m_xLabel->GetSettings().GetStyleSettings().GetWarningColor()); break; case weld::LabelType::Error: - m_xLabel->SetControlForeground(); + m_xLabel->SetControlForeground( + m_xLabel->GetSettings().GetStyleSettings().GetErrorTextColor()); m_xLabel->SetControlBackground( - m_xLabel->GetSettings().GetStyleSettings().GetHighlightColor()); + m_xLabel->GetSettings().GetStyleSettings().GetErrorColor()); break; case weld::LabelType::Title: m_xLabel->SetControlForeground( diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 8d04d9065ea6..6cf975f50d52 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -137,6 +137,9 @@ struct ImplStyleData Color maRadioCheckTextColor; Color maShadowColor; Color maWarningColor; + Color maWarningTextColor; + Color maErrorColor; + Color maErrorTextColor; Color maVisitedLinkColor; Color maToolTextColor; Color maWindowColor; @@ -562,6 +565,9 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : maRadioCheckTextColor( rData.maRadioCheckTextColor ), maShadowColor( rData.maShadowColor ), maWarningColor( rData.maWarningColor ), + maWarningTextColor( rData.maWarningTextColor ), + maErrorColor( rData.maErrorColor ), + maErrorTextColor( rData.maErrorTextColor ), maVisitedLinkColor( rData.maVisitedLinkColor ), maToolTextColor( rData.maToolTextColor ), maWindowColor( rData.maWindowColor ), @@ -662,7 +668,10 @@ void ImplStyleData::SetStandardStyles() maShadowColor = COL_GRAY; maDarkShadowColor = COL_BLACK; - maWarningColor = COL_YELLOW; + maWarningColor = Color(0xFE, 0xEF, 0xB3); // tdf#105829 + maWarningTextColor = Color(0x70, 0x43, 0x00); + maErrorColor = Color(0xFF, 0xBA, 0xBA); + maErrorTextColor = Color(0x7A, 0x00, 0x06); maDefaultButtonTextColor = COL_BLACK; maButtonTextColor = COL_BLACK; @@ -814,6 +823,45 @@ StyleSettings::GetWarningColor() const return mxData->maWarningColor; } +void +StyleSettings::SetWarningTextColor( const Color& rColor ) +{ + CopyData(); + mxData->maWarningTextColor = rColor; +} + +const Color& +StyleSettings::GetWarningTextColor() const +{ + return mxData->maWarningTextColor; +} + +void +StyleSettings::SetErrorColor( const Color& rColor ) +{ + CopyData(); + mxData->maErrorColor = rColor; +} + +const Color& +StyleSettings::GetErrorColor() const +{ + return mxData->maErrorColor; +} + +void +StyleSettings::SetErrorTextColor( const Color& rColor ) +{ + CopyData(); + mxData->maErrorTextColor = rColor; +} + +const Color& +StyleSettings::GetErrorTextColor() const +{ + return mxData->maErrorTextColor; +} + void StyleSettings::SetShadowColor( const Color& rColor ) { @@ -2520,6 +2568,9 @@ bool StyleSettings::operator ==( const StyleSettings& rSet ) const (mxData->maShadowColor == rSet.mxData->maShadowColor) && (mxData->maDarkShadowColor == rSet.mxData->maDarkShadowColor) && (mxData->maWarningColor == rSet.mxData->maWarningColor) && + (mxData->maWarningTextColor == rSet.mxData->maWarningTextColor) && + (mxData->maErrorColor == rSet.mxData->maErrorColor) && + (mxData->maErrorTextColor == rSet.mxData->maErrorTextColor) && (mxData->maButtonTextColor == rSet.mxData->maButtonTextColor) && (mxData->maDefaultActionButtonTextColor == rSet.mxData->maDefaultActionButtonTextColor) && (mxData->maActionButtonTextColor == rSet.mxData->maActionButtonTextColor) && diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index d0fb7fe0df99..7e0fa2fa5612 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -17925,9 +17925,11 @@ public: break; case weld::LabelType::Warning: set_text_background_color(Application::GetSettings().GetStyleSettings().GetWarningColor()); + set_text_foreground_color(Application::GetSettings().GetStyleSettings().GetWarningTextColor(), false); break; case weld::LabelType::Error: - set_text_background_color(Application::GetSettings().GetStyleSettings().GetHighlightColor()); + set_text_background_color(Application::GetSettings().GetStyleSettings().GetErrorColor()); + set_text_foreground_color(Application::GetSettings().GetStyleSettings().GetErrorTextColor(), false); break; case weld::LabelType::Title: set_text_foreground_color(Application::GetSettings().GetStyleSettings().GetLightColor(), true); diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx b/vcl/unx/gtk3/salnativewidgets-gtk.cxx index bf9e4872a6a9..a4e8a82aed28 100644 --- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx @@ -2435,11 +2435,6 @@ bool GtkSalGraphics::updateSettings(AllSettings& rSettings) aStyleSet.SetActiveColor( aHighlightColor ); aStyleSet.SetActiveTextColor( aHighlightTextColor ); - // warning color - GdkRGBA warning_color; - if (gtk_style_context_lookup_color(pCStyle, "warning_color", &warning_color)) - aStyleSet.SetWarningColor(getColor(warning_color)); - // field background color style_context_set_state(pCStyle, GTK_STATE_FLAG_NORMAL); ::Color aBackFieldColor = style_context_get_background_color(pCStyle);