diff --git a/src/plugins/coreplugin/stylehelper.cpp b/src/plugins/coreplugin/stylehelper.cpp
index 42ca012cf31f78f98e46c5615dd45a3068437e34..4c723449511daf23851c5b8fca62563af5d34267 100644
--- a/src/plugins/coreplugin/stylehelper.cpp
+++ b/src/plugins/coreplugin/stylehelper.cpp
@@ -48,6 +48,16 @@ static int range(float x, int min, int max)
 }
 */
 
+QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int factor)
+{
+    const int maxFactor = 100;
+    QColor tmp = colorA;
+    tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor);
+    tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor);
+    tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor);
+    return tmp;
+}
+
 qreal StyleHelper::sidebarFontSize()
 {
 #if defined(Q_WS_MAC)
diff --git a/src/plugins/coreplugin/stylehelper.h b/src/plugins/coreplugin/stylehelper.h
index 173f12cbf511d3f5f9cf10ea81d5901c4aa48907..32cc200b84a42744933f3e716fd507cf7a315a21 100644
--- a/src/plugins/coreplugin/stylehelper.h
+++ b/src/plugins/coreplugin/stylehelper.h
@@ -55,6 +55,7 @@ public:
     static QColor shadowColor();
     static QColor borderColor();
     static QColor buttonTextColor() { return QColor(0x4c4c4c); }
+    static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50);
 
     // Sets the base color and makes sure all top level widgets are updated
     static void setBaseColor(const QColor &color);
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 914c565552c75e9875f0491a36074710c83e19ea..f398b82cdb4eeb3c9f812a45b71bbcde3d819fd8 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -42,6 +42,7 @@
 #include <coreplugin/coreconstants.h>
 #include <coreplugin/editormanager/editormanager.h>
 #include <coreplugin/manhattanstyle.h>
+#include <coreplugin/stylehelper.h>
 #include <extensionsystem/pluginmanager.h>
 #include <find/basetextfind.h>
 #include <texteditor/fontsettings.h>
@@ -2260,13 +2261,11 @@ static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool e
 
     QRgb b = pal.base().color().rgb();
     QRgb h = pal.highlight().color().rgb();
-    QColor c = QColor((qRed(b)*2+qRed(h))/3,
-                      (qGreen(b)*2+qGreen(h))/3,
-                      (qBlue(b)*2+qBlue(h))/3);
+    QColor c = StyleHelper::mergedColors(b,h, 40);
 
     QLinearGradient grad(rect.topLeft(), rect.topRight());
     grad.setColorAt(0, c.lighter(110));
-    grad.setColorAt(1, c.lighter(160));
+    grad.setColorAt(1, c.lighter(130));
     QColor outline = c;
     QRect r = rect;