Theming Window nodes (border and content background colors)

Godot Version

v4.3.stable.official [77dcf97d8] on Manjaro Linux

Question

I’m totally new to Godot (it’s great overall btw :D), so it might be I miss some basic knowledge. Searching the Internet didn’t yield anything useful though, thus asking:

How do I use a theme to change the color of a Window node? I’d like to change both color of the border and the content background.

I know that my theme is connected correctly, as I can change the “title_color” and see the text color (of the window title) to change. However, I can’t find a way to change the color of the frame and the background.

I believe “embedded_border” is what I need. However, adding it and setting to StyleBoxFlat makes the frame to disappear completely, even though I set a color there (see the image)! And for the window content, I’ve no clue where to look for a correct setting :frowning:

(cross-asking on Reddit: https://www.reddit.com/r/godot/comments/1innehg/theming_window_nodes_border_and_content/)

1 Like

What’s the alpha set to on your StyleBoxFlat?

You mean the alpha component of “BG Color”? It’s set to 255:

Yeah, that’s what I meant. TBH I’ve never tried customizing these windows. I took a look at it when you posted. I can look a little more, but it’s worth asking how come you want to use a window node? What are you trying to accomplish? There’s probably an easier way to do what you’re trying to do.

What I try to accomplish is basically to have a few user-adjustable windows (movable, resizeable…) with UI controls inside, visible and usable at the same time.

More broadly, I’m trying to design a simple strategy game. The main map is meant to be always visible, but the player should have a possibility to open multiple windows on top of it, with things like unit info, statistics, minimaps… and arrange them in a way they wish.

Is there a better node meant for such a use case?

Try using a CanvasLayer node as the root, and build each layer on that. If you really want the Window functionality of moving, maximizing and minimizing, then you can just insert them into Window nodes and use anchors to have them fill up the space…

Sorry for a delay, it’s only today I have time to look deeper into this again.

I don’t quite understand. The scene hierarchy I use for this test is quite simple:

(I’ve added another window for comparison, but it shouldn’t matter)

Now I’m not sure, do you suggest that I should replace the root “Control” by a CanvasLayer ? (Control already inherits from CanvasLayer AFAIK). Or do you mean I should wrap a Label with another intermediate CanvasLayer (this one iherits from it too)?

Or do you mean I refrain from styling the window and only style the child (Label or whatever I put there)? In this case I would only be able to change the content color, but not the window’s border… (correct me if I’m wrong about that)

I’m saying build your own “window” and don’t use the Window node at all.

Ah, ok. I suppose you mean something like what somebody has done in this project: GitHub - Snirpsi/godot_control_node_window: A control node based window for godot.

It doesn’t seem have any support for theming though, so I’ve added some glue code to extract values from Theme and pass them over to the subnodes (pieces of the “window”). It seems to do the trick.

Thanks!

1 Like

Awesome! Glad that worked! Sorry for the late replies. I got really sick.

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