diff options
author | Pranam Lashkari <lpranam@collabora.com> | 2024-09-04 13:54:58 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-09-04 14:37:51 +0200 |
commit | 5a1c372ec772f7600792deef044b7f5f21a116b6 (patch) | |
tree | eaf2ef0386a6d1361fa198003414203be2114e54 /sc | |
parent | b8b5da4119791c886365c250a2ae51e601fed111 (diff) |
sc: check only background color for automatic font color
problem:
when setting font color only background color matters.
there are dark, bright and other types of color so better to keep conditions simple
Change-Id: I513f97a281a8625cbe7781a10d2a2427c9b6be2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172867
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/patattr.cxx | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 32905201def9..17ca87c1159b 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -445,7 +445,7 @@ void ScPatternAttr::fillFontOnly( rFont.SetTransparent( true ); } -void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, const SfxItemSet* pCondSet, const Color* pBackConfigColor, const Color* pTextConfigColor) +void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, const SfxItemSet* pCondSet, const Color* pBackConfigColor, const Color* /*pTextConfigColor*/) { model::ComplexColor aComplexColor; @@ -519,38 +519,17 @@ void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemS } } - // get system text color for comparison - Color aSysTextColor; - if (eAutoMode == ScAutoFontColorMode::Print) - { - aSysTextColor = COL_BLACK; - } - else if (pTextConfigColor) - { - // pTextConfigColor can be used to avoid repeated lookup of the configured color - aSysTextColor = *pTextConfigColor; - } - else - { - aSysTextColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; - } - // select the resulting color - if ( aBackColor.IsDark() && aSysTextColor.IsDark() ) + if ( aBackColor.IsDark() ) { // use white instead of dark on dark aColor = COL_WHITE; } - else if ( aBackColor.IsBright() && aSysTextColor.IsBright() ) + else { // use black instead of bright on bright aColor = COL_BLACK; } - else - { - // use aSysTextColor (black for ScAutoFontColorMode::Print, from style settings otherwise) - aColor = aSysTextColor; - } } aComplexColor.setFinalColor(aColor); rComplexColor = aComplexColor; |