Skip to content

Color.FromHex

method · Color · cAlgo.API

DesktopCLICloud

Attempts to convert a hex string to a Color.

Definition

public static Color FromHex(string hex)
Color.FromHex(hex: str) -> Color

Parameters

Name C# type Python type Description
hex string str Hex string to convert to a Color

Returns Color — A Color that represents the converted hex string.

Examples

var color = Color.FromHex("#808080");
Print("R: {0} G: {1} B: {2}", color.R, color.G, color.B);
color = Color.FromHex("#808080")
api.Print(f"R: {color.R} G: {color.G} B: {color.B}")