Use background color for checkerboard when not UNSPECIFIED.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16961
This commit is contained in:
Jeff Young 2024-02-13 18:21:20 +00:00
parent c92728715d
commit f75c72ebb5
1 changed files with 25 additions and 7 deletions

View File

@ -65,6 +65,8 @@ void COLOR_SWATCH::RenderToDC( wxDC* aDC, const KIGFX::COLOR4D& aColor,
COLOR4D black;
bool rowCycle;
if( aColor == COLOR4D::UNSPECIFIED )
{
if( aCheckerboardBackground.GetBrightness() > 0.4 )
{
white = COLOR4D::WHITE;
@ -77,6 +79,22 @@ void COLOR_SWATCH::RenderToDC( wxDC* aDC, const KIGFX::COLOR4D& aColor,
white = black.Brightened( 0.15 );
rowCycle = false;
}
}
else
{
if( aBackground.GetBrightness() > 0.4 )
{
white = aBackground;
black = white.Darkened( 0.15 );
rowCycle = true;
}
else
{
black = COLOR4D::BLACK;
white = black.Brightened( 0.15 );
rowCycle = false;
}
}
for( int x = aRect.GetLeft(); x <= aRect.GetRight(); x += aCheckerboardSize.x )
{