Related: tdf#98067 get high contrast hover/default button text color right
Normal and high contrast themes seem to behave differently
(in Windows 10)
to play more directly with themes than the usual ui try:
Press Windows Key + R and paste:
shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} -Microsoft.Personalization\pageColorization
High Contrast themes seem different to the others, with a high contrast
theme set then its possible to customize the colors, otherwise not.
Playing with 'Selected Text' it seems that this is the color used for
the active/hover button text color with a high contrast theme.
Change-Id: I561616fce6a6f6d781e4881bfdf8ba0abedcd75c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141051
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 95cb08e..d2d2f69 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2615,6 +2615,15 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
StyleSettings aStyleSettings = rSettings.GetStyleSettings();
// High contrast
HIGHCONTRAST hc;
hc.cbSize = sizeof( HIGHCONTRAST );
if( SystemParametersInfoW( SPI_GETHIGHCONTRAST, hc.cbSize, &hc, 0 )
&& (hc.dwFlags & HCF_HIGHCONTRASTON) )
aStyleSettings.SetHighContrastMode( true );
else
aStyleSettings.SetHighContrastMode( false );
aStyleSettings.SetScrollBarSize( GetSystemMetrics( SM_CXVSCROLL ) );
aStyleSettings.SetSpinSize( GetSystemMetrics( SM_CXVSCROLL ) );
UINT blinkTime = GetCaretBlinkTime();
@@ -2630,6 +2639,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
Color aControlTextColor;
Color aMenuBarTextColor;
Color aMenuBarRolloverTextColor;
Color aHighlightTextColor = ImplWinColorToSal(GetSysColor(COLOR_HIGHLIGHTTEXT));
const bool bUseDarkMode(UseDarkMode());
@@ -2680,7 +2690,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetRadioCheckTextColor( ImplWinColorToSal( GetSysColor( COLOR_WINDOWTEXT ) ) );
aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) );
aMenuBarTextColor = ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) );
aMenuBarRolloverTextColor = ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHTTEXT ) );
aMenuBarRolloverTextColor = aHighlightTextColor;
}
if ( std::optional<Color> aColor = aStyleSettings.GetPersonaMenuBarTextColor() )
@@ -2703,16 +2713,19 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetDialogColor(aStyleSettings.GetFaceColor());
aStyleSettings.SetDialogTextColor(aControlTextColor);
aStyleSettings.SetDefaultButtonTextColor(aControlTextColor);
Color aHighlightButtonTextColor = aStyleSettings.GetHighContrastMode() ?
aHighlightTextColor : aControlTextColor;
aStyleSettings.SetDefaultButtonTextColor(aHighlightButtonTextColor);
aStyleSettings.SetButtonTextColor(aControlTextColor);
aStyleSettings.SetDefaultActionButtonTextColor(aControlTextColor);
aStyleSettings.SetDefaultActionButtonTextColor(aHighlightButtonTextColor);
aStyleSettings.SetActionButtonTextColor(aControlTextColor);
aStyleSettings.SetFlatButtonTextColor(aControlTextColor);
aStyleSettings.SetDefaultButtonRolloverTextColor(aControlTextColor);
aStyleSettings.SetButtonRolloverTextColor(aControlTextColor);
aStyleSettings.SetDefaultActionButtonRolloverTextColor(aControlTextColor);
aStyleSettings.SetActionButtonRolloverTextColor(aControlTextColor);
aStyleSettings.SetFlatButtonRolloverTextColor(aControlTextColor);
aStyleSettings.SetDefaultButtonRolloverTextColor(aHighlightButtonTextColor);
aStyleSettings.SetButtonRolloverTextColor(aHighlightButtonTextColor);
aStyleSettings.SetDefaultActionButtonRolloverTextColor(aHighlightButtonTextColor);
aStyleSettings.SetActionButtonRolloverTextColor(aHighlightButtonTextColor);
aStyleSettings.SetFlatButtonRolloverTextColor(aHighlightButtonTextColor);
aStyleSettings.SetDefaultButtonPressedRolloverTextColor(aControlTextColor);
aStyleSettings.SetButtonPressedRolloverTextColor(aControlTextColor);
aStyleSettings.SetDefaultActionButtonPressedRolloverTextColor(aControlTextColor);
@@ -2732,7 +2745,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetFieldRolloverTextColor( aStyleSettings.GetFieldTextColor() );
aStyleSettings.SetListBoxWindowTextColor( aStyleSettings.GetFieldTextColor() );
aStyleSettings.SetHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHT ) ) );
aStyleSettings.SetHighlightTextColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHTTEXT ) ) );
aStyleSettings.SetHighlightTextColor(aHighlightTextColor);
aStyleSettings.SetListBoxWindowHighlightColor( aStyleSettings.GetHighlightColor() );
aStyleSettings.SetListBoxWindowHighlightTextColor( aStyleSettings.GetHighlightTextColor() );
aStyleSettings.SetMenuHighlightColor( aStyleSettings.GetHighlightColor() );
@@ -2780,15 +2793,6 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
if( SystemParametersInfoW( SPI_GETCARETWIDTH, 0, &nCaretWidth, 0 ) )
aStyleSettings.SetCursorSize( nCaretWidth );
// High contrast
HIGHCONTRAST hc;
hc.cbSize = sizeof( HIGHCONTRAST );
if( SystemParametersInfoW( SPI_GETHIGHCONTRAST, hc.cbSize, &hc, 0 )
&& (hc.dwFlags & HCF_HIGHCONTRASTON) )
aStyleSettings.SetHighContrastMode( true );
else
aStyleSettings.SetHighContrastMode( false );
// Query Fonts
vcl::Font aMenuFont = aStyleSettings.GetMenuFont();
vcl::Font aTitleFont = aStyleSettings.GetTitleFont();