diff options
author | TechnicalSoup <ben.werbowyj@gmail.com> | 2022-02-08 16:13:48 +1100 |
---|---|---|
committer | TechnicalSoup <ben.werbowyj@gmail.com> | 2022-02-08 16:37:11 +1100 |
commit | acd562be5d3295d9f5e6741e36149ca0849c9b3d (patch) | |
tree | ec2ff0d0c371849ffad09c821f37e60e8e463eaa | |
parent | 26facc054331f8810dba0c040f730111d2b27899 (diff) |
Add method descriptions to Color Class Reference
Add definitions and code examples for the html and html_is_valid methods
-rw-r--r-- | doc/classes/Color.xml | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index f3fcd90f51..4e73d4d9d8 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -218,12 +218,45 @@ <return type="Color" /> <argument index="0" name="rgba" type="String" /> <description> + Returns a new color from [code]rgba[/code], an HTML hexadecimal color string. [code]rgba[/code] is not case sensitive, and may be prefixed with a '#' character. + [code]rgba[/code] must be a valid three-digit or six-digit hexadecimal color string, and may contain an alpha channel value. If [code]rgba[/code] does not contain an alpha channel value, an alpha channel value of 1.0 is applied. + If [code]rgba[/code] is invalid a Color(0.0, 0.0, 0.0, 1.0) is returned. + [codeblocks] + [gdscript] + var green = Color.html("#00FF00FF") # set green to Color(0.0, 1.0, 0.0, 1.0) + var blue = Color.html("#0000FF") # set blue to Color(0.0, 0.0, 1.0, 1.0) + [/gdscript] + [csharp] + var green = Color.Html("#00FF00FF"); // set green to Color(0.0, 1.0, 0.0, 1.0) + var blue = Color.Html("#0000FF"); // set blue to Color(0.0, 0.0, 1.0, 1.0) + [/csharp] + [/codeblocks] </description> </method> <method name="html_is_valid" qualifiers="static"> <return type="bool" /> <argument index="0" name="color" type="String" /> <description> + Returns [code]true[/code] if [code]color[/code] is a valid HTML hexadecimal color string. [code]color[/code] is not case sensitive, and may be prefixed with a '#' character. + For a string to be valid it must be three-digit or six-digit hexadecimal, and may contain an alpha channel value. + [codeblocks] + [gdscript] + var result = Color.html_is_valid("#55aaFF") # result is true + result = Color.html_is_valid("#55AAFF20") # result is true + result = Color.html_is_valid("55AAFF") # result is true + result = Color.html_is_valid("#F2C") # result is true + result = Color.html_is_valid("#AABBC) # result is false + result = Color.html_is_valid("#55aaFF5") # result is false + [/gdscript] + [csharp] + var result = Color.HtmlIsValid("#55AAFF"); // result is true + result = Color.HtmlIsValid("#55AAFF20"); // result is true + result = Color.HtmlIsValid("55AAFF); // result is true + result = Color.HtmlIsValid("#F2C"); // result is true + result = Color.HtmlIsValid("#AABBC"); // result is false + result = Color.HtmlIsValid("#55aaFF5"); // result is false + [/csharp] + [/codeblocks] </description> </method> <method name="inverted" qualifiers="const"> |