7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 18:23:45 +00:00

ADDED: support for net name labels in color themes

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16873
This commit is contained in:
Jon Evans 2024-08-10 21:46:06 -04:00
parent 35c5c0c4d7
commit 94c094b3cc
5 changed files with 20 additions and 8 deletions

View File

@ -192,6 +192,9 @@ wxString LayerName( int aLayer )
case LAYER_SELECT_OVERLAY: return _( "Selection highlight" );
case LAYER_LOCKED_ITEM_SHADOW: return _( "Locked item shadow" );
case LAYER_CONFLICTS_SHADOW: return _( "Courtyard collision shadow" );
case NETNAMES_LAYER_ID_START: return _( "Track net names" );
case LAYER_PAD_NETNAMES: return _( "Pad net names" );
case LAYER_VIA_NETNAMES: return _( "Via net names" );
default:
wxCHECK_MSG( false, wxEmptyString, wxString::Format( "Unknown layer ID %d", aLayer ) );
@ -242,4 +245,4 @@ PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayerId, int aCopperLayersCount )
// No change for the other layers
return aLayerId;
}
}
}

View File

@ -171,6 +171,9 @@ static const std::map<int, COLOR4D> s_defaultTheme =
{ LAYER_VIA_MICROVIA, CSS_COLOR( 0, 132, 132, 1 ) },
{ LAYER_DRAWINGSHEET, CSS_COLOR( 200, 114, 171, 1 ) },
{ LAYER_PAGE_LIMITS, CSS_COLOR( 132, 132, 132, 1 ) },
{ NETNAMES_LAYER_ID_START, CSS_COLOR( 255, 255, 255, 0.7 ) },
{ LAYER_PAD_NETNAMES, CSS_COLOR( 255, 255, 255, 0.9 ) },
{ LAYER_VIA_NETNAMES, CSS_COLOR( 51, 51, 51, 0.9 ) },
{ F_Cu, CSS_COLOR( 200, 52, 52, 1 ) },
{ In1_Cu, CSS_COLOR( 127, 200, 127, 1 ) },

View File

@ -136,6 +136,9 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "board.via_through", LAYER_VIA_THROUGH );
CLR( "board.worksheet", LAYER_DRAWINGSHEET );
CLR( "board.page_limits", LAYER_PAGE_LIMITS );
CLR( "board.track_net_names", NETNAMES_LAYER_ID_START );
CLR( "board.pad_net_names", LAYER_PAD_NETNAMES );
CLR( "board.via_net_names", LAYER_VIA_NETNAMES );
CLR( "board.copper.f", F_Cu );
CLR( "board.copper.in1", In1_Cu );

View File

@ -714,6 +714,9 @@ PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS( wxWindow* aParent, BOA
m_validLayers.push_back( LAYER_PAGE_LIMITS );
m_validLayers.push_back( LAYER_DRC_WARNING );
m_validLayers.push_back( LAYER_DRC_EXCLUSION );
m_validLayers.push_back( NETNAMES_LAYER_ID_START );
m_validLayers.push_back( LAYER_PAD_NETNAMES );
m_validLayers.push_back( LAYER_VIA_NETNAMES );
// NOTE: Main board layers are added by createSwatches()

View File

@ -150,19 +150,19 @@ void PCB_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
// Colors for layers that aren't theme-able
m_layerColors[LAYER_PAD_PLATEDHOLES] = aSettings->GetColor( LAYER_PCB_BACKGROUND );
m_layerColors[LAYER_VIA_NETNAMES] = COLOR4D( 0.2, 0.2, 0.2, 0.9 );
m_layerColors[LAYER_PAD_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
m_layerColors[LAYER_VIA_NETNAMES] = aSettings->GetColor( LAYER_VIA_NETNAMES );
m_layerColors[LAYER_PAD_NETNAMES] = aSettings->GetColor( LAYER_PAD_NETNAMES );
m_layerColors[LAYER_PADS_SMD_FR] = aSettings->GetColor( F_Cu );
m_layerColors[LAYER_PADS_SMD_BK] = aSettings->GetColor( B_Cu );
m_layerColors[LAYER_PAD_FR_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
m_layerColors[LAYER_PAD_BK_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
m_layerColors[LAYER_PAD_FR_NETNAMES] = aSettings->GetColor( LAYER_PAD_NETNAMES );
m_layerColors[LAYER_PAD_BK_NETNAMES] = aSettings->GetColor( LAYER_PAD_NETNAMES );
// Netnames for copper layers
const COLOR4D lightLabel = aSettings->GetColor( NETNAMES_LAYER_ID_START );
const COLOR4D darkLabel = lightLabel.Inverted();
for( PCB_LAYER_ID layer : LSET::AllCuMask().CuStack() )
{
const COLOR4D lightLabel( 1.0, 1.0, 1.0, 0.7 );
const COLOR4D darkLabel = lightLabel.Inverted();
if( m_layerColors[layer].GetBrightness() > 0.5 )
m_layerColors[GetNetnameLayer( layer )] = darkLabel;
else