Commit ab487246 authored by Jens Bache-Wiig's avatar Jens Bache-Wiig
Browse files

Fixes: Make selection rect a little darker

Details:
Looked a bit too light in certain themes including mac.
parent 722b2318
......@@ -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)
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment