Change Background Color On Mode=Viewport, Aspect=Keep

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

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

:bust_in_silhouette: Reply From: CassanovaWong

Default clear color?


:bust_in_silhouette: Reply From: CenTdemeern1

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)

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

CenTdemeern1 | 2023-03-17 01:14