Why Panel modulate's color appears a lot darker?

Godot Version

4.4

Question

I have created a Panel , and changed the color to completely red, but then how come it look a lot darker? How can I make it so the Panel will have the color exactly as I input on modulate or self-modulate? Or must I do it some other way?

Help > UI

Hey, to fix your problem, you will need to create a StyleBoxFlat inside the panel’s theme override and set its color to red.


Make sure the modulate and self modulate is white (default)

1 Like

I think use either modulate or self_modulate, but not both. I bet they’re stacking.

modulate does the thing and its children. self_modulate only does the thing itself. But if you use both, I imagine it applies both, which means you’ll get a dimming effect.

Changing the modulate color on a black panel won’t give you pure red, it only works correctly if the base color is white. Also, I don’t think using both modulate and self_modulate makes much of a difference, whether you use one or both, the result should be the same in this case.

@KingGD i see! Thank you.

By the way, is it also possible to do this by code? I need to create panels dynamically.

1 Like

You can make a styleboxflat through code like this

var s = StyleBoxFlat.new()
panel["theme_override_styles/panel"] = s
2 Likes