Returns a [Color] constructed from red ([param r8]), green ([param g8]), blue ([param b8]), and optionally alpha ([param a8]) integer channels, each divided by [code]255.0[/code] for their final value. Using [method Color8] instead of the standard [Color] constructor is useful when you need to match exact color values in an [Image]. [codeblock] var red = Color8(255, 0, 0)# Same as Color(1, 0, 0). var dark_blue = Color8(0, 0, 51)# Same as Color(0, 0, 0.2). var my_color = Color8(306, 255, 0, 102) # Same as Color(1.2, 1, 0, 0.4). [/codeblock] [b]Note:[/b] Due to the lower precision of [method Color8] compared to the standard [Color] constructor, a color created with [method Color8] will generally not be equal to the same color created with the standard [Color] constructor. Use [method Color.is_equal_approx] for comparisons to avoid issues with floating-point precision error.
Returnerar en [Color] konstruerad från rött ([param r8]), grönt ([param g8]), blå ([param b8]), och ibland alpha ([param a8]) kanaler av heltal, varje dividerat av [code]255.0[/code] för deras slutliga värde. [codeblock] var red = Color8(255, 0, 0)# Samma som Color(1, 0, 0) var dark_blue = Color8(0, 0, 51)# Samma som Color(0, 0, 0.2). var my_color = Color8(306, 255, 0, 102) # Samma som Color(1.2, 1, 0, 0.4). [/codeblock]
[codeblock]
var red = Color8(255, 0, 0) # Same as Color(1, 0, 0).
var dark_blue = Color8(0, 0, 51) # Same as Color(0, 0, 0.2).
var my_color = Color8(306, 255, 0, 102) # Same as Color(1.2, 1, 0, 0.4).
[/codeblock]
[b]Note:[/b] Due to the lower precision of [method Color8] compared to the standard [Color] constructor, a color created with [method Color8] will generally not be equal to the same color created with the standard [Color] constructor. Use [method Color.is_equal_approx] for comparisons to avoid issues with floating-point precision error.
[codeblock]
var red = Color8(255, 0, 0) # Samma som Color(1, 0, 0)
var dark_blue = Color8(0, 0, 51) # Samma som Color(0, 0, 0.2).
var my_color = Color8(306, 255, 0, 102) # Samma som Color(1.2, 1, 0, 0.4).
[/codeblock]