0 votes

Hi,

This may be a bit of a simple one but I cannot figure out how to do it. I have tried using the color overide function but this doesn't appear to be working. Help would be greatly appreciated.

Thanks

in Engine by (292 points)

2 Answers

+2 votes

There is a Custom Styles category in panels in which you can set custom StyleBoxes.
I tested changing the Panel one with a new StyleBoxFlat, which changes the color of the panel but not dynamically.
You can set the Bg Color of the StyleBox but it doesn't update in the editor, which is not handy :p
If you run the scene however, you'll see the color.

When it's about to do that in code, I managed to get a blinking panel with this:

extends Panel

var style = StyleBoxFlat.new()

func _ready():
    # The Panel doc tells you which style names there are
    add_style_override("panel", style)
    set_process(true)

func _process(delta):
    # Some basic code animation
    var color = Color(0.5*sin(OS.get_ticks_msec()/100.0)+0.5, 0, 0)
    style.set_bg_color(color)
    # Don't forget to update so the control will redraw
    update()
by (28,733 points)
0 votes

Dated question, but I found that you can create a shadermaterial under the inspector properties window with the panel selected
Not sure this is the best way, put I got my panel to be whatever color I wanted...

(Using GODOT 3.1.1)

by (19 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.