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.
0 votes

So I have a ColorRect and I try to change its transparency thru code.
I write:
$ColorRect.color = Color(100,100,100,0) #becomes invisible
$ColorRect.color = Color(100,100,100,1) #becomes white
$ColorRect.color = Color(100,100,100,100) #becomes white
$ColorRect.color = Color(100.0,100.0,100.0,100.0) #becomes white
$ColorRect.color = Color(100,100,100,0.1) #becomes white
$ColorRect.color = Color(0.39,0.39,0.39,0.39) #becomes partially transparent
$ColorRect.color = Color("64646464") #becomes partially transparent

Is that a bug or is that supposed to work like that?

Godot version 3.4
in Engine by (88 points)
edited by

1 Answer

0 votes

Try

$ColorRect.color = Color(1, 0, 0, 1)

This should show as red

Then try playing with the zeros there. You are setting all the colours (red, blue, green) to the same value so they are blending together to make white.

by (3,328 points)

Those numbers are for example. I use various numbers. All color variations turn white if I use any 3 numbers with alpha set to anything but 0.
I don't think that colors can "blend". rgb set to 255, 255, 255 "create" white.

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.