summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-25 10:02:54 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-25 10:11:30 +0000
commit19663d39f400dac3682228f3f0146807bbbebe74 (patch)
treeaa8821c9dbea731ad88b251f9a0ea845112a0fad /vcl
parentcd28eb89d779091fafba0cf6c39a75498d4eab22 (diff)
Resolves: tdf#104598 make bright theme shadow the same as it always was
The shadow color was originally set via StyleSettings::Set3DColors taking the background color as the input, and doing DecreaseLuminance(64) on it to make the shadow color So, continue to follow that mode if the "dark shadow" is darker than the foreground, and IncreaseLuminance the equal amount the other direction for dark themes. This way under a dark theme the problem of impossible to see rulers of tdf#90214 is still fixed, while the bright theme colors are the same as they always were, which avoid the wearing-on-the-nerves "regression" problem. Change-Id: I33133ff180ecadce3a14ee45bd33db73c56c0225
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk/salnativewidgets-gtk.cxx14
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx14
2 files changed, 12 insertions, 16 deletions
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 5e07ade6ea93..e8e8cdd81ef7 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -3943,14 +3943,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
Color aDarkShadowColor = getColor( pStyle->fg[GTK_STATE_INSENSITIVE] );
aStyleSet.SetDarkShadowColor( aDarkShadowColor );
- int nRedDiff = aBackFieldColor.GetRed() - aDarkShadowColor.GetRed();
- int nGreenDiff = aBackFieldColor.GetGreen() - aDarkShadowColor.GetGreen();
- int nBlueDiff = aBackFieldColor.GetBlue() - aDarkShadowColor.GetBlue();
-
- Color aShadowColor(aBackFieldColor.GetRed() + nRedDiff / 2,
- aBackFieldColor.GetGreen() + nGreenDiff / 2,
- aBackFieldColor.GetBlue() + nBlueDiff / 2);
- aStyleSet.SetShadowColor( aShadowColor );
+ ::Color aShadowColor(aBackColor);
+ if (aDarkShadowColor.GetLuminance() > aBackColor.GetLuminance())
+ aShadowColor.IncreaseLuminance(64);
+ else
+ aShadowColor.DecreaseLuminance(64);
+ aStyleSet.SetShadowColor(aShadowColor);
// highlighting colors
Color aHighlightColor = getColor( pStyle->base[GTK_STATE_SELECTED] );
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 48edf22f9d72..e036c207489f 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2585,14 +2585,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
::Color aDarkShadowColor = getColor( color );
aStyleSet.SetDarkShadowColor( aDarkShadowColor );
- int nRedDiff = aBackFieldColor.GetRed() - aDarkShadowColor.GetRed();
- int nGreenDiff = aBackFieldColor.GetGreen() - aDarkShadowColor.GetGreen();
- int nBlueDiff = aBackFieldColor.GetBlue() - aDarkShadowColor.GetBlue();
-
- ::Color aShadowColor(aBackFieldColor.GetRed() + nRedDiff / 2,
- aBackFieldColor.GetGreen() + nGreenDiff / 2,
- aBackFieldColor.GetBlue() + nBlueDiff / 2);
- aStyleSet.SetShadowColor( aShadowColor );
+ ::Color aShadowColor(aBackColor);
+ if (aDarkShadowColor.GetLuminance() > aBackColor.GetLuminance())
+ aShadowColor.IncreaseLuminance(64);
+ else
+ aShadowColor.DecreaseLuminance(64);
+ aStyleSet.SetShadowColor(aShadowColor);
g_object_unref( pCStyle );