sudara / melatonin_inspector

A JUCE module that gives you the ability to inspect and visually edit (non-destructively) components in your UI.
MIT License
156 stars 18 forks source link

Is it possible to show where a colour for a component comes from? #127

Open 7sharp9 opened 6 days ago

7sharp9 commented 6 days ago

In the case where there might be mutiple LookAndFeels there appears to be one for each property assigned in the inspector but its not possible to know what LookAndFeel assigned it.

Screenshot 2024-11-27 at 15 04 55

Would this be an easy implemented addition?

Thanks for this great component by the way!

7sharp9 commented 6 days ago

Notice the mutiple outlineColourId props

sudara commented 3 days ago

I'm not totally sure! Would be nice.

If you feel motivated to look into it, you can poke around here to see how the colors are populated, they are properties the component has: https://github.com/sudara/melatonin_inspector/blob/main/melatonin/component_model.h#L243-L247

I can't remember at the moment all the details, but I think setColour actually adds the colors to the component by int ID — we are doing a reverse lookup, you can search in the codebase and JUCE for jcclr_ (which is how color properties are prefixed).

7sharp9 commented 2 days ago

I mean its not super important but I might take a quick look to see if its easy enough, thanks for the pointer!

7sharp9 commented 2 days ago
Screenshot 2024-12-01 at 17 25 59

I added an enum style prefix to the known colour Id's for the outline colour. The reason this came up was I couldn't tell if I had forgot to add a colour overload to a Look and Feel or if there was a different component I hadn't set. Just general confusion when inspecting juce components! ;-)

Im not sure if this needs some additional UI so show where the known enum colour is from. It might be that its just me that needed something like this...