From fbdeccebea6b5b9719c1b03c91595014e504761f Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Mon, 14 Jun 2021 14:52:12 -0600 Subject: [PATCH] Make checkbox and radio button inner symbol color less stark We've gotten some initial feedback that the radio buttons look like creepy eyeballs staring at you. This commit blends the inner dot's color with that of the surrounding color to reduce this effect. Contrast regarding which items are checked should still be there due to the color and lightness difference between checked and unchecked items; however the contrast within the control should be pleasingly reduced. Checkboxes get the same treatment to avoid them oddly using a different color for their inner symbol. --- kstyle/breezehelper.cpp | 17 ++++++++++++++--- kstyle/breezehelper.h | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/kstyle/breezehelper.cpp b/kstyle/breezehelper.cpp index f00f31fc..4632b520 100644 --- a/kstyle/breezehelper.cpp +++ b/kstyle/breezehelper.cpp @@ -152,6 +152,9 @@ namespace Breeze QColor Helper::buttonHoverOutlineColor( const QPalette& palette ) const { return KColorUtils::mix( buttonHoverColor( palette ), palette.color( QPalette::ButtonText ), 0.15 ); } + QColor Helper::checkBoxRadioButtonSymbolColor( const QPalette& palette ) const + { return KColorUtils::mix( palette.color( QPalette::Text ), palette.color( QPalette::Highlight ), 0.4 ); } + //____________________________________________________________________ QColor Helper::sidePanelOutlineColor( const QPalette& palette, bool hasFocus, qreal opacity, AnimationMode mode ) const { @@ -946,7 +949,11 @@ namespace Breeze painter->setPen(Qt::transparent); painter->setBrush(Qt::transparent); - auto checkPen = QPen( palette.text(), PenWidth::Frame * 2 ); + QBrush symbolColorBrush; + symbolColorBrush.setStyle( Qt::SolidPattern ); + symbolColorBrush.setColor( checkBoxRadioButtonSymbolColor( palette ) ); + + auto checkPen = QPen( symbolColorBrush, PenWidth::Frame * 2 ); checkPen.setJoinStyle(Qt::MiterJoin); switch (state) { @@ -957,7 +964,7 @@ namespace Breeze painter->drawPath( path ); break; case CheckPartial: - painter->setBrush( palette.text() ); + painter->setBrush( symbolColorBrush ); painter->drawRect(leftDot); painter->drawRect(centerDot); painter->drawRect(rightDot); @@ -1052,7 +1059,11 @@ namespace Breeze painter->restore(); } - painter->setBrush( palette.text() ); + // Combine palette.highlight() with palette.text() + QBrush symbolColorBrush; + symbolColorBrush.setStyle( Qt::SolidPattern ); + symbolColorBrush.setColor( checkBoxRadioButtonSymbolColor( palette ) ); + painter->setBrush( symbolColorBrush ); painter->setPen( Qt::NoPen ); QRectF markerRect; diff --git a/kstyle/breezehelper.h b/kstyle/breezehelper.h index 641b59e4..065c5332 100644 --- a/kstyle/breezehelper.h +++ b/kstyle/breezehelper.h @@ -106,6 +106,9 @@ namespace Breeze //* hover outline color, using animations QColor buttonHoverOutlineColor( const QPalette& ) const; + //* color used for the inner symbol of checkboxes and radssio buttons + QColor checkBoxRadioButtonSymbolColor( const QPalette& ) const; + //* side panel outline color, using animations QColor sidePanelOutlineColor( const QPalette&, bool hasFocus = false, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const; -- GitLab