Don't give Scintilla a colour with alpha; it doesn't know what to do.
Fixes https://gitlab.com/kicad/code/kicad/issues/10829
This commit is contained in:
parent
da7eaeffd2
commit
1b104f20b6
|
@ -82,15 +82,20 @@ void SCINTILLA_TRICKS::setupStyles()
|
||||||
wxTextCtrl dummy( m_te->GetParent(), wxID_ANY );
|
wxTextCtrl dummy( m_te->GetParent(), wxID_ANY );
|
||||||
wxColour foreground = dummy.GetForegroundColour();
|
wxColour foreground = dummy.GetForegroundColour();
|
||||||
wxColour background = dummy.GetBackgroundColour();
|
wxColour background = dummy.GetBackgroundColour();
|
||||||
wxColour highlight = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT );
|
KIGFX::COLOR4D highlight = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT );
|
||||||
wxColour highlightText = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT );
|
KIGFX::COLOR4D highlightText = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT );
|
||||||
|
|
||||||
m_te->StyleSetForeground( wxSTC_STYLE_DEFAULT, foreground );
|
m_te->StyleSetForeground( wxSTC_STYLE_DEFAULT, foreground );
|
||||||
m_te->StyleSetBackground( wxSTC_STYLE_DEFAULT, background );
|
m_te->StyleSetBackground( wxSTC_STYLE_DEFAULT, background );
|
||||||
m_te->StyleClearAll();
|
m_te->StyleClearAll();
|
||||||
|
|
||||||
m_te->SetSelForeground( true, highlightText );
|
// Scintilla doesn't handle alpha channel, which at least OSX uses in some highlight colours,
|
||||||
m_te->SetSelBackground( true, highlight );
|
// such as "graphite".
|
||||||
|
highlight = highlight.Mix( background, highlight.a ).WithAlpha( 1.0 );
|
||||||
|
highlightText = highlightText.Mix( background, highlightText.a ).WithAlpha( 1.0 );
|
||||||
|
|
||||||
|
m_te->SetSelForeground( true, highlightText.ToColour() );
|
||||||
|
m_te->SetSelBackground( true, highlight.ToColour() );
|
||||||
m_te->SetCaretForeground( foreground );
|
m_te->SetCaretForeground( foreground );
|
||||||
|
|
||||||
if( !m_singleLine )
|
if( !m_singleLine )
|
||||||
|
@ -106,13 +111,8 @@ void SCINTILLA_TRICKS::setupStyles()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the brace highlighting
|
// Set up the brace highlighting
|
||||||
unsigned char r = highlight.Red();
|
m_te->StyleSetForeground( wxSTC_STYLE_BRACELIGHT, highlightText.ToColour() );
|
||||||
unsigned char g = highlight.Green();
|
m_te->StyleSetBackground( wxSTC_STYLE_BRACELIGHT, highlight.Saturate( 0.0 ).ToColour() );
|
||||||
unsigned char b = highlight.Blue();
|
|
||||||
wxColour::MakeGrey( &r, &g, &b );
|
|
||||||
highlight.Set( r, g, b );
|
|
||||||
m_te->StyleSetForeground( wxSTC_STYLE_BRACELIGHT, highlightText );
|
|
||||||
m_te->StyleSetBackground( wxSTC_STYLE_BRACELIGHT, highlight );
|
|
||||||
m_te->StyleSetForeground( wxSTC_STYLE_BRACEBAD, *wxRED );
|
m_te->StyleSetForeground( wxSTC_STYLE_BRACEBAD, *wxRED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue