1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-13 10:32:11 +01:00

[Unloaded tab color] Make sure it work also for black color

Closes #1013
This commit is contained in:
nowrep 2013-09-17 17:03:50 +02:00
parent f8b792ed01
commit 55cbdec32c

View File

@ -274,13 +274,15 @@ void WebTab::restoreTab(const WebTab::SavedTab &tab)
if (!tab.url.isEmpty()) { if (!tab.url.isEmpty()) {
QColor col = m_view->tabWidget()->getTabBar()->palette().text().color(); QColor col = m_view->tabWidget()->getTabBar()->palette().text().color();
QColor lighter = col.lighter(250); QColor newCol = col.lighter(250);
// Make sure it works for white color
if (col == lighter) { // It won't work for black color because (V) = 0
lighter = col.darker(250); // It won't also work for white, as white won't get any lighter
if (col == Qt::black || col == Qt::white) {
newCol = Qt::gray;
} }
m_view->tabWidget()->getTabBar()->overrideTabTextColor(index, lighter); m_view->tabWidget()->getTabBar()->overrideTabTextColor(index, newCol);
} }
} }
else { else {