Changing the tint_progress through script for texture progress bar?

Godot Version

v4.2.2

###Question
I am trying to make healthbar for my player using texture progress bar and I have given the progress a simple white sprite because what I want is that I want to change its color through script by changing the tint_progress color value based on the current value of the progress. following is my code for progress bar

extends TextureProgressBar
@onready var player = %Player

func _ready():
player.connect(“reduce_health”,changeProgressValue)

func changeProgressValue(MAX_value,cur_value):
value = cur_value/MAX_value * 100
tint_progress = Color(200,value*2,0,255)

But nothing is happening. I don’t know why but when write 100 instead of value in the Color() the color is changed. But I want to change it dynamically.
Also, my value is starting from 100 all the way to 0. and tint color by default is (200,200,0,255).
and I also have checked the tint value by printing it on console when ever value changes and it does change.
One more thing that I have checked the value it is always integer I also checked by using ceil function.
Any ideas?

you’ll need to divide the color by 255.0 first if you try to set it like that. because constructor for color is in float 0.0 to 1.0

1 Like

Use Color8() if you want to use values from 0 to 255 per channel.