Skip to content

Commit 604e1c1

Browse files
committed
Merge pull request #104410 from aaronfranke/color-space-doc
Add color space alpha notes to Color documentation
2 parents 217d1c6 + f651516 commit 604e1c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/classes/Color.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<description>
77
A color represented in RGBA format by a red ([member r]), green ([member g]), blue ([member b]), and alpha ([member a]) component. Each component is a 32-bit floating-point value, usually ranging from [code]0.0[/code] to [code]1.0[/code]. Some properties (such as [member CanvasItem.modulate]) may support values greater than [code]1.0[/code], for overbright or HDR (High Dynamic Range) colors.
88
Colors can be created in various ways: By the various [Color] constructors, by static methods such as [method from_hsv], and by using a name from the set of standardized colors based on [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url] with the addition of [constant TRANSPARENT]. GDScript also provides [method @GDScript.Color8], which uses integers from [code]0[/code] to [code]255[/code] and doesn't support overbright colors.
9+
Color data may be stored in many color spaces and encodings. The [method srgb_to_linear] and [method linear_to_srgb] methods can convert between nonlinear sRGB encoding and linear RGB encoding.
910
[b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it is equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code].
1011
[url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/color_constants.png]Color constants cheatsheet[/url]
1112
</description>
@@ -364,12 +365,14 @@
364365
<return type="Color" />
365366
<description>
366367
Returns the color converted to the [url=https://en.wikipedia.org/wiki/SRGB]sRGB[/url] color space. This method assumes the original color is in the linear color space. See also [method srgb_to_linear] which performs the opposite operation.
368+
[b]Note:[/b] The color's [member a]lpha channel is not affected. The alpha channel is always stored with linear encoding, regardless of the color space of the other color channels.
367369
</description>
368370
</method>
369371
<method name="srgb_to_linear" qualifiers="const">
370372
<return type="Color" />
371373
<description>
372374
Returns the color converted to the linear color space. This method assumes the original color already is in the sRGB color space. See also [method linear_to_srgb] which performs the opposite operation.
375+
[b]Note:[/b] The color's [member a]lpha channel is not affected. The alpha channel is always stored with linear encoding, regardless of the color space of the other color channels.
373376
</description>
374377
</method>
375378
<method name="to_abgr32" qualifiers="const">
@@ -492,6 +495,7 @@
492495
<members>
493496
<member name="a" type="float" setter="" getter="" default="1.0">
494497
The color's alpha component, typically on the range of 0 to 1. A value of 0 means that the color is fully transparent. A value of 1 means that the color is fully opaque.
498+
[b]Note:[/b] The alpha channel is always stored with linear encoding, regardless of the color space of the other color channels. The [method linear_to_srgb] and [method srgb_to_linear] methods do not affect the alpha channel.
495499
</member>
496500
<member name="a8" type="int" setter="" getter="" default="255">
497501
Wrapper for [member a] that uses the range 0 to 255, instead of 0 to 1.

0 commit comments

Comments
 (0)