Struct Color4
- Namespace
- Lime
- Assembly
- Lime.dll
Representation of 4-byte color (RGBA).
public struct Color4 : IEquatable<Color4>
- Implements
- Inherited Members
Constructors
Color4(byte, byte, byte, byte)
public Color4(byte r, byte g, byte b, byte a = 255)
Parameters
Color4(uint)
public Color4(uint abgr)
Parameters
abgr
uint
Fields
A
public byte A
Field Value
ABGR
[YuzuMember("0")]
public uint ABGR
Field Value
B
public byte B
Field Value
Black
public static readonly Color4 Black
Field Value
Blue
public static readonly Color4 Blue
Field Value
DarkGray
public static readonly Color4 DarkGray
Field Value
G
public byte G
Field Value
Gray
public static readonly Color4 Gray
Field Value
Green
public static readonly Color4 Green
Field Value
Orange
public static readonly Color4 Orange
Field Value
R
public byte R
Field Value
Red
public static readonly Color4 Red
Field Value
Transparent
public static readonly Color4 Transparent
Field Value
White
public static readonly Color4 White
Field Value
Yellow
public static readonly Color4 Yellow
Field Value
Zero
public static readonly Color4 Zero
Field Value
Methods
CreateArgb(byte, byte, byte, byte)
Creates an ARGB color-int from a specified alpha, red, green and blue components.
public static int CreateArgb(byte alpha, byte red, byte green, byte blue)
Parameters
alpha
byteAlpha component of the color.
red
byteRed component of the color.
green
byteGreen component of the color.
blue
byteBlue component of the color.
Returns
- int
ARGB color-int.
Darken(float)
Darken the color with the specified amount. Amount 1 turns the color into black, Amount 0 remains the color unchanged.
public Color4 Darken(float amount)
Parameters
amount
float
Returns
Equals(Color4)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Color4 other)
Parameters
other
Color4An object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
FromFloats(float, float, float, float)
public static Color4 FromFloats(float r, float g, float b, float a = 1)
Parameters
Returns
GetAlphaComponent(int)
Gets the alpha component from a specified ARGB color-int.
public static byte GetAlphaComponent(int color)
Parameters
color
intThe color as integer value in ARGB format.
Returns
- byte
Alpha.
GetBlueComponent(int)
Gets the blue component from a specified ARGB color-int.
public static byte GetBlueComponent(int color)
Parameters
color
intThe color as integer value in ARGB format.
Returns
- byte
Blue.
GetGreenComponent(int)
Gets the green component from a specified ARGB color-int.
public static byte GetGreenComponent(int color)
Parameters
color
intThe color as integer value in ARGB format.
Returns
- byte
Green.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
GetRedComponent(int)
Gets the red component from a specified ARGB color-int.
public static byte GetRedComponent(int color)
Parameters
color
intThe color as integer value in ARGB format.
Returns
- byte
Red.
Lerp(float, Color4, Color4)
Creates a new Color4 that contains linear interpolation of the specified colors.
public static Color4 Lerp(float amount, Color4 value1, Color4 value2)
Parameters
amount
floatWeighting value(between 0.0 and 1.0).
value1
Color4The first color.
value2
Color4The second color.
Returns
Lighten(float)
Lighten the color with the specified amount. Amount 1 turns the color into white, Amount 0 remains the color unchanged.
public Color4 Lighten(float amount)
Parameters
amount
float
Returns
Parse(string)
public static Color4 Parse(string s)
Parameters
s
string
Returns
PremulAlpha(Color4)
Multiplies every component of color with its alpha.
public static Color4 PremulAlpha(Color4 color)
Parameters
color
Color4
Returns
RGB(uint)
public static Color4 RGB(uint rgb)
Parameters
rgb
uint
Returns
RGBA(uint)
public static Color4 RGBA(uint rgba)
Parameters
rgba
uint
Returns
ToString()
Returns the string representation of this Color4 in the format: "#R.G.B.A", where R, G, B, A are represented by hexadecimal numbers.
public override string ToString()
Returns
ToString(StringPresentation)
public string ToString(Color4.StringPresentation presentation)
Parameters
presentation
Color4.StringPresentation
Returns
ToVector4()
public Vector4 ToVector4()
Returns
Transparentify(float)
Change the color transparency with the specified amount. Amount 1 turns the color into fully transparent, Amount 0 remains the color unchanged.
public Color4 Transparentify(float amount)
Parameters
amount
float
Returns
TryParse(string, out Color4)
public static bool TryParse(string s, out Color4 result)
Parameters
Returns
Operators
operator ==(Color4, Color4)
public static bool operator ==(Color4 lhs, Color4 rhs)
Parameters
Returns
operator !=(Color4, Color4)
public static bool operator !=(Color4 lhs, Color4 rhs)
Parameters
Returns
operator *(Color4, Color4)
Component-wise multiplication of two colors.
public static Color4 operator *(Color4 lhs, Color4 rhs)