How to change color of button backgorund in gdscript?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By magagovnarita

How can I set bg_color in styleboxflat?
I tried many variables of that - here one of this -


or that

get_node("belarusbutton").set("custom_styles/normal.bg_color", Color(1,0,0,1))

“belarusbutton” is my button
I don’t get how it’s need to be?

:bust_in_silhouette: Reply From: Dlean Jeans
$belarusbutton["custom_styles/normal"].bg_color = Color("#bada55")

Oh, thanks. it’s works

magagovnarita | 2020-08-10 07:36

How do you do it within the node?

cloa513 | 2022-03-21 02:23

By using the keyword self

self["custom_styles/normal"].bg_color = Color("#bada55")

senshellshark | 2022-05-05 20:00