Hello,
A few X11 programs use colors taken from Xresources (xrdb -query), among which those using FLTK (on X11, not Wayland) or Tcl/tk.
In these programs, if no other color has been explicitly defined, the selected texts are not distinguishable from the non-selected texts, which can make the program barely usable.
You can experiment this in Tcl/tk by saving, making executable and running the following lines (upper part uses “Entry” configuration, bottom part uses “Text” configuration: they can be set as different, but in MATE/Yaru themes both have invisible selections):
#!/usr/bin/wish
entry .en
.en insert 0 "Entry sample"
text .txt -height 2 -width 20
.txt insert 0.0 "Text sample"
pack .en .txt
A request was previously made to manually tweak the selection colors, by editing the file /usr/share/themes/YOUR_THEME/gtk-3.0/gtk.css . I cannot use it because the file /usr/share/themes/Yaru-blue/gtk-3.0/gtk.css is just an import, and I do not know how to change the original data:
@import url("resource:///com/ubuntu/themes/Yaru-blue/3.0/gtk.css");
This previous request:
Anyway, the real problem is not about tweaking the colors: the problem is present in all MATE standard themes (Yaru-…), so there should be a general solution. Especially since there seems to be no user-friendly way to change these colors.
What happens: when a theme is selected, the program /usr/libexec/mate-settings-daemon sends to /usr/bin/xrdb -merge -quiet the following lines (only useful lines included), for Yaru-blue:
#define BACKGROUND #fafafa
#define FOREGROUND #3d3d3d
#define SELECT_BACKGROUND #fafafa
#define SELECT_FOREGROUND #3d3d3d
#define WINDOW_BACKGROUND #fafafa
#define WINDOW_FOREGROUND #3d3d3d
...
*Text.background: WINDOW_BACKGROUND
*Text.foreground: WINDOW_FOREGROUND
*Text.highlightBackground: WINDOW_BACKGROUND
*Text.highlightColor: WINDOW_FOREGROUND
*Text.activeBackground: WINDOW_BACKGROUND
*Text.activeForeground: WINDOW_FOREGROUND
*Text.selectBackground: SELECT_BACKGROUND
*Text.selectForeground: SELECT_FOREGROUND
As you can see, the values for SELECT_FOREGROUND/SELECT_BACKGROUND are the same as for FOREGROUND/BACKGROUND, hence the text selection is not visible.
My workaround so far is:
- Create a
~/.Xresourceswith the following lines:
#define SELECT_BACKGROUND #4040c0
#define SELECT_FOREGROUND #ffffff
*Entry.selectBackground: SELECT_BACKGROUND
*Entry.selectForeground: SELECT_FOREGROUND
*Text.selectBackground: SELECT_BACKGROUND
*Text.selectForeground: SELECT_FOREGROUND
*Listbox.selectBackground: SELECT_BACKGROUND
*Listbox.selectForeground: SELECT_FOREGROUND
*Canvas.selectbackground: SELECT_BACKGROUND
*Canvas.selectforeground: SELECT_FOREGROUND
- create a start-up task, with a delay of 5 seconds (because Xresources are overwritten by the theme), with command:
xrdb -merge /home/MYLOGIN/.Xresources
With this, I am happy, my system works correctly. But really, it is just a workaround.