Update background colour of main window

Hello everyone! I’m pretty new to both JUCE and this forum. Here’s the situation:
I added in the Popup menu (of the toolbar of the main window) the possibility to change between a light and a dark theme. I made a custom look and feel class, and it works. The only problem is that it doesn’t update the background colour of the main window.
Also, I think the toolbar is slightly transparent, because when its colour is white it appears grey when the main background is black, same thing with black on a white background, while white on white and black on black look good.

I’m using setLookAndFeel to update the theme on all windows, and it all works except for the main window background.

I’m mainly looking for two solutions:
1- Is there a way to make the toolbar completely opaque?
2- If that isn’t possible, how can I change the background colour of the main window without making a new one?

If you’re using a native toolbar, then any opacity or other styling is going to be completely up to the OS so you wouldn’t be able to specify to have a solid colour without changing preferences in your OS.

Sounds like you might just need to call repaint on the top-level component when you change the theme? What code are you running when an option from the menu is selected?

I typically use setDefaultLookAndFeel() rather then setting it on a specific component.

I’m already using sendLookAndFeelChange(), which should automatically repaint the object and all its children, but it doesn’t seem to change the background.

You shouldn’t need to call that manually, it gets called after you change the look-and-feel for a component.

How have you set the window’s colour? Do you have a component that fills the whole background, or are you using the colour passed to juce::DocumentWindow's constructor?

I’m using the colour passed to the window’s constructor.
Oh, btw, sorry I used the wrong word, i meant MenuBar

You can call setBackgroundColour() on the DocumentWindow to update the background colour.
I’d recommend overriding lookAndFeelChanged() in your DocumentWindow class and calling setBackgroundColour from it, something like:

void lookAndFeelChanged() override
    setBackgroundColour (findColour (juce::ResizableWindow::backgroundColourId));

I solved it. I switched to LookAndFeel V3, which has a completely opaque menu bar (exactly what I needed).
Thank you!