From 0d3e8e3d097d8c464df1a06fe54f37a7544fa021 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Wed, 1 Dec 2021 23:05:08 +0100 Subject: [PATCH] Make ERC/DRC item lightness proportional to default text brightness Fixes https://gitlab.com/kicad/code/kicad/issues/9824 --- common/rc_item.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/rc_item.cpp b/common/rc_item.cpp index 3eead8c268..4edc851ed4 100644 --- a/common/rc_item.cpp +++ b/common/rc_item.cpp @@ -419,11 +419,17 @@ bool RC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem, if( node->m_RcItem->GetParent() && node->m_RcItem->GetParent()->IsExcluded() ) { wxColour textColour = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXTEXT ); + double brightness = KIGFX::COLOR4D( textColour ).GetBrightness(); - if( KIGFX::COLOR4D( textColour ).GetBrightness() > 0.5 ) - aAttr.SetColour( textColour.ChangeLightness( heading ? 30 : 35 ) ); + if( brightness > 0.5 ) + { + int lightness = static_cast( brightness * ( heading ? 50 : 60 ) ); + aAttr.SetColour( textColour.ChangeLightness( lightness ) ); + } else + { aAttr.SetColour( textColour.ChangeLightness( heading ? 170 : 165 ) ); + } aAttr.SetItalic( true ); // Strikethrough would be better, if wxWidgets supported it ret = true;