OK, I have run the code in debug and found the explanation.
It might make sense (it's a feature, not a bug), but FLTK appears to be almost the only software that behaves this way, so it might not be very good.
Call stack:
#0 getsyscolor (key1="Text", key2="selectBackground", arg=0, defarg="#000080", func=<set_selection_color(uchar, uchar, uchar)>) (fltk-1.4.4/src/drivers/X11/Fl_X11_Screen_Driver.cxx:541)
#1 Fl_X11_Screen_Driver::get_system_colors(this=<optimized out>) (fltk-1.4.4/src/drivers/X11/Fl_X11_Screen_Driver.cxx:563)
#2 Fl::get_system_colors() (fltk-1.4.4/src/Fl_get_system_colors.cxx:133)
#3 Fl_Window::show(this=..., argc=1, argv=...) (fltk-1.4.4/src/Fl_arg.cxx:290)
#4 main(argc=1, argv=<optimized out>) (fltk-1.4.4/fluid/fluid.cxx:2261)
The calls in Fl_X11_Screen_Driver::get_system_colors() produce:
* getsyscolor("Text","background", fl_bg2, "#ffffff", Fl::background2);
XGetDefault(fl_display, "Text", "background"); => "#fafafa"
* getsyscolor(key1, "foreground", fl_fg, "#000000", Fl::foreground);
XGetDefault(fl_display, "fltk", "foreground"); => "#3d3d3d"
* getsyscolor(key1, "background", fl_bg, "#c0c0c0", Fl::background);
XGetDefault(fl_display, "fltk", "background"); => "#fafafa"
* getsyscolor("Text", "selectBackground", 0, "#000080", set_selection_color);
arg = XGetDefault(fl_display, "Text", "selectBackground"); => "#fafafa"
And this is consistent with the values returned by the X11 Resources on my system:
$ xrdb -query
...
*Text.activeBackground: #fafafa
*Text.activeForeground: #3d3d3d
*Text.background: #fafafa
*Text.foreground: #3d3d3d
*Text.highlightBackground: #fafafa
*Text.highlightColor: #3d3d3d
*Text.selectBackground: #fafafa
*Text.selectForeground: #3d3d3d
...
But it looks like very few softwares use the "*Text.selectBackground" information, at least when it is stupidly the same at the other text backgrounds.
These lines are not taken from an Xresources file, instead they appear to be generated by /usr/libexec/mate-settings-daemon and sent to "/usr/bin/xrdb -merge -quiet" when the session is started or when the theme is modified. In my case, it generates a text containing:
#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
I just created the file ~/.Xresources containing the single line:
*Text.selectBackground: #80FF80
and run:
$ xrdb -merge ~/.Xresources
$ xrdb -query
...
*Text.selectBackground: #80FF80
...
And the selected texts now appear with a light green background, as requested.
My theme in Ubuntu-MATE is "Yaru-blue".
A similar problem was reported with a similar theme, when using Tcl/tk applications:
So I know how to do a workaround for my system, but I don't know whether this is a bug that needs to be fixed.
What I do know is that the other softwares don't care about it.