1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Add background to numbers on meter, IF meter bar and number colour is too similar.

This happens in Hi-Contrast theme.
This commit is contained in:
James Crook
2017-04-26 16:28:41 +01:00
parent 6bcbe417e9
commit e08ceaf099
3 changed files with 17 additions and 5 deletions

View File

@@ -341,6 +341,13 @@ void ThemeBase::RecolourBitmap( int iIndex, wxColour From, wxColour To )
ReplaceImage( iIndex, pResult.get() );
}
int ThemeBase::ColourDistance( wxColour & From, wxColour & To ){
return
abs( From.Red() - To.Red() )
+ abs( From.Green() - To.Green() )
+ abs( From.Blue() - To.Blue() );
}
// This function coerces a theme to be more like the system colours.
// Only used for built in themes. For custom themes a user
// will choose a better theme for them and just not use a mismatching one.
@@ -353,10 +360,7 @@ void ThemeBase::RecolourTheme()
wxColour To = wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE );
#endif
// only recolour if recolouring is slight.
int d =
abs( From.Red() - To.Red() )
+ abs( From.Green() - To.Green() )
+ abs( From.Blue() - To.Blue() );
int d = ColourDistance( From, To );
// Don't recolour if difference is too big.
if( d > 120 )