Indeed, I have found someone else with the same problem... the Mozilla developers! It appears that these are scraped by nsLookAndFeel.cpp, which exists separately for each toolkit (mac, gtk2, qt) They have tons of comments in their code explaining that they're not sure what they're doing, just like mine.
Code:
// It's really hard to effectively map these to the Appearance Manager properly,
// since they are modeled word for word after the win32 system colors and don't have any
// real counterparts in the Mac world. I'm sure we'll be tweaking these for
// years to come.
...
// NOTE: this is an MDI color and does not exist on macOS.
//used the closest match, which will likely be white.
The gtk2 file uses statements like this:
PHP Code:
case eColor_highlight:
// background of selected item
aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_SELECTED]);
break;
Whereas the qt version does things like this:
PHP Code:
case eColor_highlight:
aColor = QCOLOR_TO_NS_RGB(activeGroup.highlight());
break;
This seems pretty similar to what I'm doing. They also create an invisible widget to get the style from:
PHP Code:
mWidget = gtk_invisible_new();
gtk_object_ref(GTK_OBJECT(mWidget));
gtk_object_sink(GTK_OBJECT(mWidget));
gtk_widget_ensure_style(mWidget);
mStyle = gtk_widget_get_style(mWidget);
The reason some of their colors don't match, like the desktop color, is because they aren't really trying too hard. They just get a color from GTK instead of trying to figure out what Gnome or Xfce specifies for the desktop color:
PHP Code:
case eColor_background:
// desktop background
aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
break;
I tried the test page with Epiphany-WebKit for comparison, and they don't even try. The colors are hardcoded and nothing changes if I change the theme.
Bookmarks