Wrap around highlights to ensure distinguishing

Bright colors are maxed out for highlighting.  Modestly darkening them
helps to distinguish them from their neighbors but keep the blue value
to help "glow" the selection

Fixes https://gitlab.com/kicad/code/kicad/issues/5560
This commit is contained in:
Seth Hillbrand 2021-09-24 17:09:55 -07:00
parent 0dc585e518
commit c69a16ca6d
1 changed files with 13 additions and 1 deletions

View File

@ -64,7 +64,19 @@ void RENDER_SETTINGS::update()
// Linear brightening doesn't work well for colors near white
double factor = ( m_selectFactor * 0.6 ) + pow( m_layerColors[i].GetBrightness(), 3 );
m_layerColorsSel[i] = m_layerColors[i].Brightened( std::min( factor, 1.0 ) );
factor = std::min( 1.0, factor );
m_layerColorsSel[i] = m_layerColors[i].Brightened( factor );
// If we are maxed out on brightening as a highlight, fallback to darkening but keep
// the blue that acts as a "glowing" color
if( std::fabs( m_layerColorsSel[i].GetBrightness() - m_layerColors[i].GetBrightness() )
< 0.05 )
{
m_layerColorsSel[i] = m_layerColors[i].Darkened( m_selectFactor * 0.4 );
m_layerColorsSel[i].b = m_layerColors[i].b * ( 1.0 - factor ) + factor;
}
}
}