diff options
author | Dan Gudmundsson <[email protected]> | 2019-06-25 16:22:13 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2019-06-25 16:22:13 +0200 |
commit | 1274131e7dbfe0d351b7bc6a99bdd8198a673385 (patch) | |
tree | a6223a59913dff0f9a062433601f349834e0b9df /lib/observer/src/observer_lib.erl | |
parent | 528e55e44cf1ee32d90d8c4c4d5790d18cae79bc (diff) | |
download | otp-1274131e7dbfe0d351b7bc6a99bdd8198a673385.tar.gz otp-1274131e7dbfe0d351b7bc6a99bdd8198a673385.tar.bz2 otp-1274131e7dbfe0d351b7bc6a99bdd8198a673385.zip |
observer: Fixes for html viewers
Diffstat (limited to 'lib/observer/src/observer_lib.erl')
-rw-r--r-- | lib/observer/src/observer_lib.erl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/observer/src/observer_lib.erl b/lib/observer/src/observer_lib.erl index 5cb6645cb9..7d115306bd 100644 --- a/lib/observer/src/observer_lib.erl +++ b/lib/observer/src/observer_lib.erl @@ -28,7 +28,7 @@ interval_dialog/4, start_timer/1, start_timer/2, stop_timer/1, timer_config/1, display_info/2, display_info/3, fill_info/2, update_info/2, to_str/1, create_menus/3, create_menu_item/3, - is_darkmode/1, create_attrs/1, + is_darkmode/1, colors/1, create_attrs/1, set_listctrl_col_size/2, mix/3, create_status_bar/1, html_window/1, html_window/2, @@ -373,15 +373,19 @@ create_menu_item(separator, Menu, Index) -> wxMenu:insertSeparator(Menu, Index), Index+1. -create_attrs(Window) -> +colors(Window) -> DarkMode = is_darkmode(wxWindow:getBackgroundColour(Window)), - Font = wxSystemSettings:getFont(?wxSYS_DEFAULT_GUI_FONT), Text = case wxSystemSettings:getColour(?wxSYS_COLOUR_LISTBOXTEXT) of {255,255,255,_} when not DarkMode -> {10,10,10}; %% Is white on Mac for some reason Color -> Color end, Even = wxSystemSettings:getColour(?wxSYS_COLOUR_LISTBOX), Odd = mix(Even, wxSystemSettings:getColour(?wxSYS_COLOUR_HIGHLIGHT), 0.8), + #colors{fg=rgb(Text), even=rgb(Even), odd=rgb(Odd)}. + +create_attrs(Window) -> + Font = wxSystemSettings:getFont(?wxSYS_DEFAULT_GUI_FONT), + #colors{fg=Text, even=Even, odd=Odd} = colors(Window), #attrs{even = wxListItemAttr:new(Text, Even, Font), odd = wxListItemAttr:new(Text, Odd, Font), deleted = wxListItemAttr:new(?FG_DELETED, ?BG_DELETED, Font), @@ -392,6 +396,9 @@ create_attrs(Window) -> searched = wxListItemAttr:new(Text, ?BG_SEARCHED, Font) }. +rgb({R,G,B,_}) -> {R,G,B}; +rgb({_,_,_}=RGB) -> RGB. + mix(RGB,{MR,MG,MB,_}, V) -> mix(RGB, {MR,MG,MB}, V); mix({R,G,B,_}, RGB, V) -> |