|
6 | 6 | <description>
|
7 | 7 | 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.
|
8 | 8 | 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. |
9 | 10 | [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].
|
10 | 11 | [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/color_constants.png]Color constants cheatsheet[/url]
|
11 | 12 | </description>
|
|
364 | 365 | <return type="Color" />
|
365 | 366 | <description>
|
366 | 367 | 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. |
367 | 369 | </description>
|
368 | 370 | </method>
|
369 | 371 | <method name="srgb_to_linear" qualifiers="const">
|
370 | 372 | <return type="Color" />
|
371 | 373 | <description>
|
372 | 374 | 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. |
373 | 376 | </description>
|
374 | 377 | </method>
|
375 | 378 | <method name="to_abgr32" qualifiers="const">
|
|
492 | 495 | <members>
|
493 | 496 | <member name="a" type="float" setter="" getter="" default="1.0">
|
494 | 497 | 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. |
495 | 499 | </member>
|
496 | 500 | <member name="a8" type="int" setter="" getter="" default="255">
|
497 | 501 | Wrapper for [member a] that uses the range 0 to 255, instead of 0 to 1.
|
|
0 commit comments