Custom plugin background colours


#1

How to fill the background with the hex colour #3f3f3f
or rgb (63, 63, 63)
this is probably a stupid question but i really cant work out how to do it aha


#2

I think you can fill the background like this.

void paint (Graphics& g)
{
   g.fillAll(Colour(0xff3f3f3f));
}

#3

@SUBARU’s suggestion will work. But if you’d rather work with RGB values you could do:

void paint (Graphics& g)
{
    g.fillAll(Colour(63, 63, 63));
}

#4

okay thanks, but how do i implement this? does it go in look and feel? if it is i dont understand how to access it.


#5

From the subject title, you are trying to fill the plugin background, right?
If so, you have main plugin editor class like “PluginEditor”.
Then you can add above code in there.


#6

done that now i get a build error.


i get many more errors with the other void paint not as a comment


#7

It belongs into the .cpp, not the .h


#8

in .h

void paint (Graphics& g) override;

in .cpp

void yourClassName::paint (Graphics& g)
{
   g.fillAll(Colour(0xff3f3f3f));
}

I think this will work.


#9

if i have the class name in the function on the cpp it creates a build error, without it is fine. when i load it up however it really messes up the ui


#10

I have no idea about those gui glitches.
If you don’t fill the background, your gui is fine?


#11

Well I cannot work on code ATM so I will let you know tomorrow, however I do know when I use my own hex or RGB colour codes this happens, when I use preset juce colours it doesn’t


#12

A common beginner mistake is to think that if you type Colour (0x112233), it’ll be opaque. It won’t because you’re giving it a 32-bit integer, not a string like for web-colours, and without an alpha value in the top bits, the colour is completely transparent.


#13

well it isnt opaque if i use the 32 bit version it just causes ui glitches, this applies as well if i use the rgb colour code (74, 75, 94)