Struct Color
Represents a color.
Implements
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
[DataContract]
public struct Color : IEquatable<Color>
Properties
| Improve this Doc View SourceA
Gets the alpha element of the color. 0 is fully transparent and 255 is fully opaque.
Declaration
public byte A { get; }
Property Value
Type | Description |
---|---|
System.Byte | The alpha element of the color. |
B
Gets the blue element of the color. 0 is no red and 255 is fully blue.
Declaration
public byte B { get; }
Property Value
Type | Description |
---|---|
System.Byte | The blue element of the color. |
G
Gets the green element of the color. 0 is no red and 255 is fully green.
Declaration
public byte G { get; }
Property Value
Type | Description |
---|---|
System.Byte | The green element of the color. |
R
Gets the red element of the color. 0 is no red and 255 is fully red.
Declaration
public byte R { get; }
Property Value
Type | Description |
---|---|
System.Byte | The red element of the color. |
Value
A single value which encodes the color within it, 8 bits per color element, where the order is A (alpha)-R (red)-G (green)-B (blue).
Declaration
[DataMember(Name = "Argb")]
public uint Value { get; }
Property Value
Type | Description |
---|---|
System.UInt32 | The color value. |
Methods
| Improve this Doc View SourceEquals(Color)
Declaration
public bool Equals(Color other)
Parameters
Type | Name | Description |
---|---|---|
Color | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
FromArgb(Byte, Byte, Byte, Byte)
Gets a color from ARGB elements (alpha, red, green, blue).
Declaration
public static Color FromArgb(byte a, byte r, byte g, byte b)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | a | The alpha component. |
System.Byte | r | The red component. |
System.Byte | g | The green component. |
System.Byte | b | The blue component. |
Returns
Type | Description |
---|---|
Color | The color. |
FromHexa(UInt32)
Gets a color from a hexa value (in ARGB format).
Declaration
public static Color FromHexa(uint argb)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | argb | ARGB. |
Returns
Type | Description |
---|---|
Color | The hexa. |
FromHsla(Int32, Single, Single, Byte)
Gets a color from HSLA format (https://en.wikipedia.org/wiki/HSL_and_HSV). Also see: https://css-tricks.com/yay-for-hsla/, and a helpful calculator: https://www.w3schools.com/colors/colors_hsl.asp
Declaration
public static Color FromHsla(int hue, float saturation, float lightness, byte a)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | hue | Hue: Think of a color wheel. Around 0o and 360o are reds 120o are greens, 240o are blues. Use anything in between 0-360. Values above and below will be modulus 360. |
System.Single | saturation | Saturation: 0 is completely denatured (grayscale). 1 is fully saturated (full color). |
System.Single | lightness | Lightness: 0 is completely dark (black). 1 is completely light (white). |
System.Byte | a | The alpha component: 0 is fully transparent. 255 is fully opaque. |
Returns
Type | Description |
---|---|
Color | The color. |
FromRgba(Byte, Byte, Byte, Byte)
Gets a color from RGBA elements (red, green, blue, alpha).
Declaration
public static Color FromRgba(byte r, byte g, byte b, byte a)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | r | The red component. |
System.Byte | g | The green component. |
System.Byte | b | The blue component. |
System.Byte | a | The alpha component. |
Returns
Type | Description |
---|---|
Color | The color. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
GetHue()
Gets the hue of the color (based on HSL format: https://en.wikipedia.org/wiki/HSL_and_HSV).
Declaration
public int GetHue()
Returns
Type | Description |
---|---|
System.Int32 | The hue. |
GetLightness()
Gets the lightness of the color (based on HSL format: https://en.wikipedia.org/wiki/HSL_and_HSV).
Declaration
public float GetLightness()
Returns
Type | Description |
---|---|
System.Single | The saturation. |
GetSaturation()
Gets the saturation of the color (based on HSL format: https://en.wikipedia.org/wiki/HSL_and_HSV).
Declaration
public float GetSaturation()
Returns
Type | Description |
---|---|
System.Single | The saturation. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
WithAlpha(Byte)
Gets a new color with a changed alpha (transparency).
Declaration
public Color WithAlpha(byte a)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | a | The alpha component. 0 is fully transparent and 255 is fully opaque. |
Returns
Type | Description |
---|---|
Color | The color. |