They should also obey the colours set to the LookAndFeel. In the juce LookAndFeels the PopupMenu of a ComboBox only follows the LookAndFeel, not the ComboBox it is targeting, see here:
You can find fixes in the various posts in that thread where I worked around it, but they all involve patching the LookAndFeel to get the colour from the targetComponent rather than from the LookAndFeel.findColour().
Further to what Daniel said, there’s an example of a LookAndFeel which extracts colour information from the PopupMenu’s target component in the WidgetsDemo:
The important bit is to override the WithOptions version of the look and feel method, after which you can call findColour on the target component, if it is set.
I was using your Foleys Look and Feel and I was trying to change the colours of the submenus, making them equal to the parent menus, by simply calling that:
Now I get that in normal situations (using the standard juce LookAndFeels) this wasn’t possible.
Just to clarify and learn from your suggestion.
By overriding the draw withOptions method, I can get the targetComponent() (that in my case is the ComboBox) and so get the targetComponent → findColour(ColourId) colour, that I can use to draw -text, separators, background- colours ?
Exactly. Originally the PopupMenu didn’t have the PopupMenu::Options, so there was no way to communicate things like the targetComponent to the LookAndFeel.
To avoid breaking existing code the drawPopupMenu* methods were kept, but future LookAndFeels have now access to the Options struct.