From bdd1b3b5469a045b71343fbf721a512f9cd2b0e8 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 19 Dec 2013 17:16:57 -0200 Subject: Make it possible to use the Tag System in dark themes The color used on the bright theme was cyan, and it's too bright when the font is also white. This patch uses the HSL information of the color to determine if the text color is light or dark, and adjusting the background color for that. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/groupedlineedit.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'qt-ui/groupedlineedit.cpp') diff --git a/qt-ui/groupedlineedit.cpp b/qt-ui/groupedlineedit.cpp index 72eb59d41..915e4688b 100644 --- a/qt-ui/groupedlineedit.cpp +++ b/qt-ui/groupedlineedit.cpp @@ -207,7 +207,12 @@ void GroupedLineEdit::paintEvent(QPaintEvent *e) i.toFront(); path.addRoundedRect(rectangle, 5.0, 5.0); painter.setPen(i.peekNext()); - painter.setBrush(i.next().lighter(180)); + if (palette().color(QPalette::Text).lightnessF() <= 0.3 ) + painter.setBrush(i.next().lighter()); + else if (palette().color(QPalette::Text).lightnessF() <= 0.6 ) + painter.setBrush(i.next()); + else + painter.setBrush(i.next().darker()); painter.drawPath(path); } #endif -- cgit v1.2.3-70-g09d2