sc/source/ui/dbgui/csvgrid.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit de387e611df7668fb86a409255de6d49eeef3e90
Author:     Rafael Lima <rafael.palma.l...@gmail.com>
AuthorDate: Mon Oct 10 21:20:22 2022 +0200
Commit:     Rafael Lima <rafael.palma.l...@gmail.com>
CommitDate: Mon Nov 7 13:16:24 2022 +0100

    tdf#147386 Fix text color in CSV import dialog (dark mode)
    
    If FONTCOLOR is set to Automatic, then check the background color and 
adjust the font color to Black or White depending whether the background is 
dark.
    
    Change-Id: I3c277291f8aa3a3e63a050c28c8f17b05f4dbf2e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141177
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index 82e2909cc195..27d76e2ac30b 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -250,7 +250,16 @@ void ScCsvGrid::InitColors()
     maGridColor = mpColorConfig->GetColorValue( ::svtools::CALCGRID ).nColor;
     maGridPBColor = mpColorConfig->GetColorValue( ::svtools::CALCPAGEBREAK 
).nColor;
     maAppBackColor = mpColorConfig->GetColorValue( ::svtools::APPBACKGROUND 
).nColor;
-    maTextColor = mpColorConfig->GetColorValue( ::svtools::FONTCOLOR ).nColor;
+    maTextColor = mpColorConfig->GetColorValue( ::svtools::FONTCOLOR, false 
).nColor;
+
+    // tdf#147386 If Automatic font color is used, then check backgroud color 
and use Black/White as font color
+    if ( maTextColor == COL_AUTO )
+    {
+        if ( maBackColor.IsDark() )
+            maTextColor = COL_WHITE;
+        else
+            maTextColor = COL_BLACK;
+    }
 
     const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
     maHeaderBackColor = rSett.GetFaceColor();

Reply via email to