Skip to content

Commit

Permalink
minor colour update to GTK builds
Browse files Browse the repository at this point in the history
  • Loading branch information
eranif committed Apr 17, 2022
1 parent 441c4bb commit 9a30fcd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions Plugin/clSystemSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ wxColour clSystemSettings::GetDefaultPanelColour()
{
wxColour panel_colour;
panel_colour = GetColour(IS_GTK ? wxSYS_COLOUR_WINDOW : wxSYS_COLOUR_3DFACE);
#ifdef __WXGTK__
if(!m_useCustomColours && !DrawingUtils::IsDark(panel_colour)) {
panel_colour = panel_colour.ChangeLightness(95);
}
#endif
return panel_colour;
}

Expand Down
15 changes: 9 additions & 6 deletions Plugin/clThemedTextCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@
#define wxSTC_MAX_MARGIN 4
#endif

#if defined(__WXMSW__)
#define BORDER_STYLE wxBORDER_SIMPLE
#elif defined(__WXGTK__)
#define BORDER_STYLE wxBORDER_DEFAULT
#else
#define BORDER_STYLE wxBORDER_DEFAULT
#endif

clThemedTextCtrl::clThemedTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos,
const wxSize& size, long style)
{
wxUnusedVar(style);
#ifdef __WXMSW__
wxStyledTextCtrl::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE);
#else
wxStyledTextCtrl::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_DEFAULT);
#endif

wxStyledTextCtrl::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, BORDER_STYLE);
ApplySettings();

SetYCaretPolicy(0, 0);
Expand Down
6 changes: 5 additions & 1 deletion Plugin/lexer_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,16 @@ void LexerConf::SetKeyWords(const wxString& keywords, int set)
void LexerConf::ApplySystemColours(wxStyledTextCtrl* ctrl)
{
Apply(ctrl);
wxColour fg_colour = clSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
wxColour bg_colour = clSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
if(!DrawingUtils::IsDark(bg_colour)) {
bg_colour = *wxWHITE;
} else {
// dark colour, make it a bit darker
bg_colour = bg_colour.ChangeLightness(50);
fg_colour = wxColour(*wxWHITE).ChangeLightness(90);
}

wxColour fg_colour = clSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
for(int i = 0; i < wxSTC_STYLE_MAX; ++i) {
ctrl->StyleSetBackground(i, bg_colour);
ctrl->StyleSetForeground(i, fg_colour);
Expand Down

0 comments on commit 9a30fcd

Please sign in to comment.