Difference between revisions of "Color fromAny"
(Created page with "{{CGscriptMethods_Template|ReturnType=Color|Name=<nowiki>Color_fromAny</nowiki>|Parameters= {{CGscriptParameters_Template|Type=object|Name=<nowiki>color</nowiki>|Description=<...") |
|||
Line 3: | Line 3: | ||
|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>}} | ||
+ | |||
+ | <source lang="javascript"> | ||
+ | Color c = Color_fromAny("orange"); | ||
+ | print(c.Red);//255 | ||
+ | print(c.Green);//165 | ||
+ | print(c.Blue);//0 | ||
+ | </source> | ||
+ | |||
[[Category:General_Functions]] | [[Category:General_Functions]] |
Revision as of 09:27, 6 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("orange");
print(c.Red);//255
print(c.Green);//165
print(c.Blue);//0