Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Color fromAny: Difference between revisions

From Catglobe Wiki
Created page with "{{CGscriptMethods_Template|ReturnType=Color|Name=<nowiki>Color_fromAny</nowiki>|Parameters= {{CGscriptParameters_Template|Type=object|Name=<nowiki>color</nowiki>|Description=<..."
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[Category:General_Functions]]
{{CGscriptMethods_Template|ReturnType=Color|Name=<nowiki>Color_fromAny</nowiki>|Parameters=
{{CGscriptMethods_Template|ReturnType=Color|Name=<nowiki>Color_fromAny</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=object|Name=<nowiki>color</nowiki>|Description=<nowiki>Object to convert to color</nowiki>}}
{{CGscriptParameters_Template|Type=object|Name=<nowiki>color</nowiki>|Description=<nowiki>Object to convert to color</nowiki>}}
|InClass=<nowiki>Color</nowiki>
|InClass=<nowiki>Color</nowiki>
|Description=<nowiki>Create new color object from anything that can be converted, E.g. {255,0,0}, {255,0,0,32}, "pink", "#FF0000", new Color("pink", false)</nowiki>}}
|Description=<nowiki>Create new color object from anything that can be converted, E.g. {255,0,0}, {255,0,0,32}, "pink", "#FF0000", new Color("pink", false)</nowiki>}}
[[Category:General_Functions]]
 
<source lang="javascript">
Color c = Color_fromAny("pink");
//Color c = Color_fromAny({255,192,203});
//Color c = Color_fromAny("#ffc0cb");
//Color c = Color_fromAny(new Color ("pink",false));
print(c.Red);//255
print(c.Green);//192
print(c.Blue);//203
print(c.HtmlRgbHex);//#ffc0cb
</source>

Latest revision as of 04:30, 24 May 2021

  • Color Color_fromAny(object color "Object to convert to color") - Create new color object from anything that can be converted, E.g. {255,0,0}, {255,0,0,32}, "pink", "#FF0000", new Color("pink", false)
Color c = Color_fromAny("pink");
//Color c = Color_fromAny({255,192,203});
//Color c = Color_fromAny("#ffc0cb");
//Color c = Color_fromAny(new Color ("pink",false));
print(c.Red);//255
print(c.Green);//192
print(c.Blue);//203
print(c.HtmlRgbHex);//#ffc0cb