From ffd03aaf668001f4e3278597dfdc775e5fe2a9b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com>
Date: Mon, 15 Jun 2009 15:35:06 +0200
Subject: [PATCH] Fixed issues with line number colors on dark themes

By using the palette foreground color for line numbers when the
background is very dark, instead of the palette's "dark" color.
---
 src/plugins/texteditor/fontsettingspage.cpp | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp
index 740740443c..cb19938828 100644
--- a/src/plugins/texteditor/fontsettingspage.cpp
+++ b/src/plugins/texteditor/fontsettingspage.cpp
@@ -143,10 +143,23 @@ QString FormatDescription::trName() const
 
 QColor FormatDescription::foreground() const
 {
-    if (m_name == QLatin1String(Constants::C_LINE_NUMBER))
-        return QApplication::palette().dark().color();
-    if (m_name == QLatin1String(Constants::C_PARENTHESES))
+    if (m_name == QLatin1String(Constants::C_LINE_NUMBER)) {
+        const QColor bg = QApplication::palette().background().color();
+        if (bg.value() < 128) {
+            return QApplication::palette().foreground().color();
+        } else {
+            return QApplication::palette().dark().color();
+        }
+    } else if (m_name == QLatin1String(Constants::C_CURRENT_LINE_NUMBER)) {
+        const QColor bg = QApplication::palette().background().color();
+        if (bg.value() < 128) {
+            return QApplication::palette().foreground().color();
+        } else {
+            return m_format.foreground();
+        }
+    } else if (m_name == QLatin1String(Constants::C_PARENTHESES)) {
         return QColor(Qt::red);
+    }
     return m_format.foreground();
 }
 
-- 
GitLab