[Solved] Theme picker

gui

#1

Hi!
So i’m trying to make a theme picker for my synth but i can’t get it to work.
Currently the main window has a tab component with multiple tabs in there for rotaries and various other components. In one of the tabs i’ve got a ComboBox with a couple of themes to pick from. Once an item has been chosen, I want to change the colours of components based on the theme i chose.
I’ve tried to create an enum for my custom look and feel and then

setColour(CustomLookAndFeel::themeColourId, newColour);

which would later be used in the components to find that colour and use it. But that didn’t work.
Tried to use a random id

setColour(1234, newColour);

given that it hadn’t been specified but nothing there either.

Does anyone have a good solution for this?

EDIT: Sorry if a lot of this was vague or complicated. First post.


#2

Solved this by saving indexes of themes in an AudioParameterChoice which is stored globally.
I then call upon the index and based on that it’ll set the colour of the theme.

This is just in case someone was wondering.


#3

Sounds like a good solution.

Another idea would be to have several LookAndFeel instances in an OwnedArray and call in your main UI (like AudioPluginEditor)

setLookAndFeel (lnfList.getUnchecked (i));

and have a setup method, that fills the various colour values into the instances. Projucer uses the BinaryData for that, which is a nice and easily maintainable solution (and allows to add own edited files later on):


#4

Oh yeah that sounds like a good solution as well. Probably less messy than my solution but for now i’ll just stick with what i’ve done. Still, thanks for the solution! :slight_smile: