diff --git a/src/plugins/coreplugin/welcomepagehelper.cpp b/src/plugins/coreplugin/welcomepagehelper.cpp index 636888d6b47..c1cf35beb3d 100644 --- a/src/plugins/coreplugin/welcomepagehelper.cpp +++ b/src/plugins/coreplugin/welcomepagehelper.cpp @@ -856,10 +856,8 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti painter->save(); painter->translate(bgRGlobal.topLeft()); - const QColor fill(themeColor(hovered ? Theme::Token_Foreground_Muted - : Theme::Token_Background_Muted)); - const QPen pen(themeColor(hovered ? Theme::Token_Foreground_Muted - : Theme::Token_Stroke_Subtle), itemOutlineWidth); + const QColor fill(themeColor(hovered ? cardHoverBackground : cardDefaultBackground)); + const QPen pen(themeColor(hovered ? cardHoverStroke : cardDefaultStroke), itemOutlineWidth); WelcomePageHelpers::drawCardBackground(painter, bgR, fill, pen, itemCornerRounding); const int shiftY = thumbnailAreaR.bottom(); @@ -915,7 +913,7 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti constexpr int filterMargin = hoverBlurRadius; QImage thumbnail(bgR.size() + QSize(filterMargin, filterMargin) * 2, QImage::Format_ARGB32_Premultiplied); - thumbnail.fill(themeColor(Theme::Token_Foreground_Muted)); + thumbnail.fill(themeColor(cardHoverBackground)); QPainter thumbnailPainter(&thumbnail); thumbnailPainter.translate(filterMargin, filterMargin); thumbnailPainter.fillRect(thumbnailAreaR, @@ -924,8 +922,7 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti thumbnailPainter.setPen(titleTF.color()); drawPixmapOverlay(item, &thumbnailPainter, option, thumbnailAreaR); thumbnailPainter.setOpacity(1.0 - hoverBlurOpacity); - thumbnailPainter.fillRect(thumbnail.rect(), - themeColor(Theme::Token_Foreground_Muted)); + thumbnailPainter.fillRect(thumbnail.rect(), themeColor(cardHoverBackground)); thumbnailPainter.end(); qt_blurImage(thumbnail, hoverBlurRadius, false, false); @@ -944,7 +941,7 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti const QPixmap thumbnailPortionPM = m_blurredThumbnail.copy(backgroundPortionR); painter->drawPixmap(backgroundPortionR.topLeft(), thumbnailPortionPM); } else { - painter->fillRect(thumbnailAreaR, themeColor(Theme::Token_Foreground_Muted)); + painter->fillRect(thumbnailAreaR, themeColor(cardHoverBackground)); } } diff --git a/src/plugins/coreplugin/welcomepagehelper.h b/src/plugins/coreplugin/welcomepagehelper.h index 6856a59a99e..84a6ec358b3 100644 --- a/src/plugins/coreplugin/welcomepagehelper.h +++ b/src/plugins/coreplugin/welcomepagehelper.h @@ -59,6 +59,10 @@ public: CORE_EXPORT void setBackgroundColor(QWidget *widget, Utils::Theme::Color colorRole); constexpr qreal defaultCardBackgroundRounding = 3.75; +constexpr Utils::Theme::Color cardDefaultBackground = Utils::Theme::Token_Background_Muted; +constexpr Utils::Theme::Color cardDefaultStroke = Utils::Theme::Token_Stroke_Subtle; +constexpr Utils::Theme::Color cardHoverBackground = Utils::Theme::Token_Foreground_Subtle; +constexpr Utils::Theme::Color cardHoverStroke = cardHoverBackground; CORE_EXPORT void drawCardBackground(QPainter *painter, const QRectF &rect, const QBrush &fill, const QPen &pen = QPen(Qt::NoPen), qreal rounding = defaultCardBackgroundRounding); diff --git a/src/plugins/extensionmanager/extensionsbrowser.cpp b/src/plugins/extensionmanager/extensionsbrowser.cpp index dba1936d607..d83c1ef3ee2 100644 --- a/src/plugins/extensionmanager/extensionsbrowser.cpp +++ b/src/plugins/extensionmanager/extensionsbrowser.cpp @@ -329,10 +329,13 @@ public: { const bool selected = option.state & QStyle::State_Selected; const bool hovered = option.state & QStyle::State_MouseOver; - const QColor fillColor = creatorTheme()->color(hovered ? Theme::Token_Foreground_Muted - : Theme::Token_Background_Muted); - const QColor strokeColor = creatorTheme()->color(selected ? Theme::Token_Stroke_Strong - : Theme::Token_Stroke_Subtle); + const QColor fillColor = + creatorTheme()->color(hovered ? WelcomePageHelpers::cardHoverBackground + : WelcomePageHelpers::cardDefaultBackground); + const QColor strokeColor = + creatorTheme()->color(selected ? Theme::Token_Stroke_Strong + : hovered ? WelcomePageHelpers::cardHoverStroke + : WelcomePageHelpers::cardDefaultStroke); WelcomePageHelpers::drawCardBackground(painter, itemRect, fillColor, strokeColor); } { diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index 431fa8ee1d0..5ca983329ec 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -232,10 +232,8 @@ static QPixmap pixmap(const QString &id, const Theme::Color color) static void drawBackgroundRect(QPainter *painter, const QRectF &rect, bool hovered) { - const QColor fill(themeColor(hovered ? Theme::Token_Foreground_Muted - : Theme::Token_Background_Muted)); - const QPen pen(themeColor(hovered ? Theme::Token_Foreground_Muted - : Theme::Token_Stroke_Subtle)); + const QColor fill(themeColor(hovered ? cardHoverBackground : cardDefaultBackground)); + const QPen pen(themeColor(hovered ? cardHoverStroke : cardDefaultStroke)); const qreal rounding = s(defaultCardBackgroundRounding * 1000) / 1000.0; const qreal saneRounding = rounding <= 2 ? 0 : rounding;