summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2023-03-19 17:42:15 +0100
committerYuri Sizov <yuris@humnom.net>2023-03-27 17:35:47 +0200
commit9559bbcb182a8822c7226abed0bcc734d861da3e (patch)
tree70e5a0cbc1fb77c0681aceb770a131fdb2f6b410 /modules
parent30a9b5fe9b3af2c3056bfb5fe9f9e5df380ed7e6 (diff)
Improve Color8 documentation
This documents in which situations Color8 is most suited and its precision limitations. (cherry picked from commit 4e4555bea56fd9fd0734b0d6d0800977f9976b95)
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index effc0aab96..13d223b0d9 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -18,12 +18,13 @@
<param index="2" name="b8" type="int" />
<param index="3" name="a8" type="int" default="255" />
<description>
- 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.
+ 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.
</description>
</method>
<method name="assert">