This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

You can see in the below image that when you set the stretch settings in the Project Settings of your project to Mode=Viewport and Aspect=Keep, the default background color for the extra space is black.

Would there be any way to change this color, for example to the same shade of blue as this image, or to white? Is this customizable?

enter image description here

in Engine by (44 points)

2 Answers

–3 votes
by (214 points)
+1 vote

In Godot 3.X, use:
VisualServer.black_bars_set_images(left, top, right, bottom)
This method expects you to provide RIDs for your images, which you can obtain using RID(image_object).

Example usage:

var img = load("res://image.png")

func _ready():
    var img_rid = RID(img)
    VisualServer.black_bars_set_images(img_rid, img_rid, img_rid, img_rid)
by (16 points)

(I'm not sure if this still exists in Godot 4. I checked the docs but couldn't find anything.)

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 Frequently asked questions and 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 [email protected] with your username.