The panel color is displayed incorrectly

Godot Version

Godot 4.2.1 Stable

Question

Hello.
I want to set the bg_color value of a Panel to a different color, here’s my code:

var edit_panel_style: StyleBoxFlat = edit_panel.get_theme_stylebox("Panel")
edit_panel_style.set_bg_color(background_color)
edit_panel.remove_theme_stylebox_override("Panel")
edit_panel.add_theme_stylebox_override("Panel", edit_panel_style)

I used a lot of methods to detect the color of the Panel, and the results were correct, but not the correct color.

I used translation software, I’m sorry if you can’t read it.
Thank you very much!!!

OK. I get the right code:

var edit_panel_style: StyleBoxFlat = StyleBoxFlat.new()
edit_panel_style.set_bg_color(background_color)
edit_panel.add_theme_stylebox_override("panel", edit_panel_style)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.