From c3001f007f031841834df0f67e654ed94389ede3 Mon Sep 17 00:00:00 2001 From: lionelc Date: Wed, 11 Aug 2010 18:45:34 +0200 Subject: loading color: (highlight + 2*background)/3 --- src/urlbar/urlbar.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/urlbar/urlbar.cpp') diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index c5b89516..d924a30d 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -185,12 +185,22 @@ void UrlBar::paintEvent(QPaintEvent *event) } else { - QColor loadingColor = Application::palette().color(QPalette::ToolTipBase); - if (abs(loadingColor.lightness() - foregroundColor.lightness()) < 50) + QColor highlight = Application::palette().color(QPalette::Highlight); + + int r = (highlight.red()+2*backgroundColor.red())/3; + int g = (highlight.green()+2*backgroundColor.green())/3; + int b = (highlight.blue()+2*backgroundColor.blue())/3; + + QColor loadingColor(r, g, b); + + if (abs(loadingColor.lightness() - backgroundColor.lightness()) < 20) //eg. Gaia color scheme { - loadingColor = Application::palette().color(QPalette::Highlight); + r = (2*highlight.red()+backgroundColor.red())/3; + g = (2*highlight.green()+backgroundColor.green())/3; + b = (2*highlight.blue()+backgroundColor.blue())/3; + loadingColor = QColor(r, g, b); } - + QLinearGradient gradient( QPoint(0, 0), QPoint(width(), 0) ); gradient.setColorAt(0, loadingColor); gradient.setColorAt(((double)progr) / 100 - .000001, loadingColor); -- cgit v1.2.1