In particular this is an issue for tree cell renderers (probably table as well) - we have renderers that set their background color based on UIManager.getColor("Tree.selectionBackground"). What we get is a slightly different shade of blue than the one the tree will be painted with.
This is in general a huge problem for any third party (including us) who wants to write a custom component which will fit with the operating system, or provide custom UI delegates for a component - there simply is no way to get this information.
In Synth L&F, UIManager.getColor("control") need to return values that are pulled from the look and feel (in GTK, from the desktop theme). If that is impossible, some API similar to SynthStyle.getColorForState() (currently a this method is private - I will try using it via reflection, but such code is fragile).
For my part, I don't particularly care if fetching colors is done via UIManager.getColor() (though this solution is the least intrusive for third party components/uis), or via some API method on GTKLookAndFeel, or better, on SynthLookAndFeel. The main requirements are that:
- The color returned accurately reflect the color in use by the theme at the time of the call
- The call not require a live component to necessarily be passed in - we're talking about usage by components the look and feel won't know about. So, something similar to getColorForState() either without the SynthContext argument, or without requiring the SynthContext's getComponent method return non null.
Since GTK look and feel supports LIGHT/MID/DARK/BLACK/WHITE keys (see GtkColorType), any solution should allow these values to be fetched, ideally via UIManager. Should only require a simple subclass of UIDefaults.ActiveValue to implement.