Color.FromName
method · Color · cAlgo.API
DesktopCLICloud
Creates a color from the specified name of a predefined color.
Definition
public static Color FromName(string name)
Color.FromName(name: str) -> Color
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
name | string | str | Name of predefined color |
Returns Color — A Color for specified name or color with value #00000000 if the name was not found.
Examples
var greenColor = Color.FromName("Green");
if (greenColor != Color.Empty)
Chart.DrawHorizontalLine("level", Bars.ClosePrices.LastValue, greenColor);
greenColor = Color.FromName("Green")
if greenColor != Color.Empty:
api.Chart.DrawHorizontalLine("level", api.Bars.ClosePrices.LastValue, greenColor)