Fix highlighting
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
-define(H, 255). % High
|
||||
-define(M, 192). % Medium
|
||||
-define(L, 128). % Low
|
||||
-define(D, 64). % Deep-Low
|
||||
-define(X, 32). % X-Low
|
||||
-define(Z, 0). % Zilch
|
||||
|
||||
@@ -46,8 +47,9 @@
|
||||
-define(brown, {?L, ?L, ?Z}).
|
||||
-define(magenta, {?L, ?Z, ?L}).
|
||||
-define(cyan, {?Z, ?L, ?L}).
|
||||
-define(not_black, {?X, ?X, ?X}).
|
||||
-define(grey, {?L, ?L, ?L}).
|
||||
-define(dark_grey, {?D, ?D, ?D}).
|
||||
-define(not_black, {?X, ?X, ?X}).
|
||||
-define(white, {?M, ?M, ?M}).
|
||||
|
||||
styles() ->
|
||||
@@ -67,6 +69,7 @@ palette(light) ->
|
||||
?STRING => ?red,
|
||||
?NUMBER => ?magenta,
|
||||
?OPERATOR => ?brown,
|
||||
sel_back => ?grey,
|
||||
line_num => ?brown,
|
||||
cursor => ?black,
|
||||
bg => ?high_white};
|
||||
@@ -78,6 +81,7 @@ palette(dark) ->
|
||||
?STRING => ?light_red,
|
||||
?NUMBER => ?light_magenta,
|
||||
?OPERATOR => ?yellow,
|
||||
sel_back => ?dark_grey,
|
||||
line_num => ?yellow,
|
||||
cursor => ?white,
|
||||
bg => ?not_black}.
|
||||
@@ -118,7 +122,8 @@ set_text(STC, Text) ->
|
||||
|
||||
set_colors(STC) ->
|
||||
ok = wxStyledTextCtrl:styleClearAll(STC),
|
||||
Palette = #{bg := BGC, cursor := CC, line_num := LNC} = palette(color_mode()),
|
||||
Palette = palette(color_mode()),
|
||||
#{bg := BGC, cursor := CC, line_num := LNC, sel_back := SFB} = Palette,
|
||||
Colorize =
|
||||
fun(Style) ->
|
||||
Color = maps:get(Style, Palette),
|
||||
@@ -126,6 +131,7 @@ set_colors(STC) ->
|
||||
ok = wxStyledTextCtrl:styleSetBackground(STC, Style, BGC)
|
||||
end,
|
||||
ok = wxStyledTextCtrl:setCaretForeground(STC, CC),
|
||||
ok = wxStyledTextCtrl:setSelBackground(STC, true, SFB),
|
||||
ok = wxStyledTextCtrl:styleSetForeground(STC, ?wxSTC_STYLE_LINENUMBER, LNC),
|
||||
ok = wxStyledTextCtrl:styleSetBackground(STC, ?wxSTC_STYLE_DEFAULT, BGC),
|
||||
lists:foreach(Colorize, styles()).
|
||||
|
||||
Reference in New Issue
Block a user