Color.FromArgb
method · Color · cAlgo.API
DesktopCLICloud
Creates a color from alpha, red, green and blue components.
Overloads
| Signature | Description |
|---|---|
FromArgb(int alpha, int red, int green, int blue) | Creates a color from alpha, red, green and blue components. |
FromArgb(int alpha, Color baseColor) | Creates a color from existing color, but with new specified alpha value. |
FromArgb(int argb) | Creates a color from a 32-bit ARGB value. |
FromArgb(int red, int green, int blue) | Creates a color from red, green and blue values. The alpha value is implicitly 255 (fully opaque). |
FromArgb(int alpha, int red, int green, int blue)
Creates a color from alpha, red, green and blue components.
public static Color FromArgb(int alpha, int red, int green, int blue)
Color.FromArgb(alpha: int, red: int, green: int, blue: int) -> Color
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
alpha | int | int | Alpha value from 0 to 255 |
red | int | int | Red value from 0 to 255 |
green | int | int | Green value from 0 to 255 |
blue | int | int | Blue value from 0 to 255 |
Returns Color — The Color for specified parameters.
Examples
var greenColor = Color.FromArgb(255, 0, 255, 0);
Chart.DrawHorizontalLine("level", Bars.ClosePrices.LastValue, greenColor);
greenColor = Color.FromArgb(255, 0, 255, 0)
api.Chart.DrawHorizontalLine("level", api.Bars.ClosePrices.LastValue, greenColor)
FromArgb(int alpha, Color baseColor)
Creates a color from existing color, but with new specified alpha value.
public static Color FromArgb(int alpha, Color baseColor)
Color.FromArgb(alpha: int, baseColor: Color) -> Color
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
alpha | int | int | New alpha value from 0 to 255 |
baseColor | Color | Color | Base color from which red, green and blue values will be copied to a new color |
Returns Color — The Color for specified parameters.
Examples
var transparentBlue = Color.FromArgb(128, Color.Blue);
var zone = Chart.DrawRectangle("zone", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, transparentBlue);
zone.IsFilled = true;
transparentBlue = Color.FromArgb(128, Color.Blue)
zone = api.Chart.DrawRectangle("zone", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, transparentBlue)
zone.IsFilled = True
FromArgb(int argb)
Creates a color from a 32-bit ARGB value.
public static Color FromArgb(int argb)
Color.FromArgb(argb: int) -> Color
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
argb | int | int | Color ARGB 32-bit integer value |
Returns Color — The Color for specified parameter.
Examples
var semiTransparentOrange = Color.FromArgb(unchecked((int)0x80FFA500));
Print("Color: {0}", semiTransparentOrange.ToHexString());
semiTransparentOrange = Color.FromArgb(Color.Orange.ToArgb())
api.Print(f"Color: {semiTransparentOrange.ToHexString()}")
FromArgb(int red, int green, int blue)
Creates a color from red, green and blue values. The alpha value is implicitly 255 (fully opaque).
public static Color FromArgb(int red, int green, int blue)
Color.FromArgb(red: int, green: int, blue: int) -> Color
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
red | int | int | Red value from 0 to 255 |
green | int | int | Green value from 0 to 255 |
blue | int | int | Blue value from 0 to 255 |
Returns Color — The Color for specified parameters.
Examples
var greenColor = Color.FromArgb(0, 255, 0);
Chart.ColorSettings.BullFillColor = greenColor;
greenColor = Color.FromArgb(0, 255, 0)
api.Chart.ColorSettings.BullFillColor = greenColor