Color Struct
Represents a color.
public struct Color : IEquatable<Color>
Public Structure Color
Implements IEquatable(Of Color)
Implements
Properties
A
Gets the color opacity (0 = fully transparent, 255 = fully opaque).
Property Value
The color opacity.
Argb
Gets the Opacity, Red, Green and Blue components in a single Int32 value.
Property Value
B
Gets the Blue component (from 0 to 255).
Property Value
The Blue component.
G
Gets the Green component (from 0 to 255).
Property Value
The Green component.
Name
Gets the color name.
Property Value
The color name.
R
Gets the Red component (from 0 to 255).
Property Value
The Red component.
Methods
Equals(Color)
Parameters
other
- Color
The other color to compare with this color instance.
Returns
Equals(Object)
public override bool Equals(object obj)
Public Overrides Function Equals(obj As Object) As Boolean
Parameters
Returns
Overrides
FromHsl(Int32, Int32, Int32)
Creates a new color instance from the specified Hue, Saturation and Lightness components.
public static Color FromHsl(int h, int s, int l)
Public Shared Function FromHsl(h As Integer, s As Integer, l As Integer) As Color
Parameters
The Hue component (from 0 to 255).
The Saturation component (from 0 to 255).
The Lightness component (from 0 to 255).
Returns
A new color instance from the specified Hue, Saturation and Lightness components.
FromHsl(Int32, Int32, Int32, Double)
Creates a new color instance from the specified Hue, Saturation and Lightness components and transparency.
public static Color FromHsl(int h, int s, int l, double transparency)
Public Shared Function FromHsl(h As Integer, s As Integer, l As Integer, transparency As Double) As Color
Parameters
The Hue component (from 0 to 255).
The Saturation component (from 0 to 255).
The Lightness component (from 0 to 255).
transparency
- Double
The transparency (0 = fully opaque, 1 = fully transparent).
Returns
A new color instance from the specified Hue, Saturation and Lightness components and transparency.
FromName(ColorName)
Creates a new color instance from the specified color name.
public static Color FromName(ColorName name)
Public Shared Function FromName(name As ColorName) As Color
Parameters
name
- ColorName
The color name.
Returns
A color instance with the specified name.
FromName(ColorName, Double)
Creates a new color instance from the specified color name and luminance.
public static Color FromName(ColorName name, double luminance)
Public Shared Function FromName(name As ColorName, luminance As Double) As Color
Parameters
name
- ColorName
The color name.
luminance
- Double
The luminance (-1 = darkest, 0 = none, 1 = lightest).
Returns
A color instance with the specified name and luminance.
FromName(ColorName, Double, Double)
Creates a new color instance from the specified color name, luminance and transparency.
public static Color FromName(ColorName name, double luminance, double transparency)
Public Shared Function FromName(name As ColorName, luminance As Double, transparency As Double) As Color
Parameters
name
- ColorName
The color name.
luminance
- Double
The luminance (-1 = darkest, 0 = none, 1 = lightest).
transparency
- Double
The transparency (0 = fully opaque, 1 = fully transparent).
Returns
A color instance with the specified name, luminance and transparency.
FromRgb(Int32, Int32, Int32)
Creates a new color instance from the specified Red, Green and Blue components.
public static Color FromRgb(int r, int g, int b)
Public Shared Function FromRgb(r As Integer, g As Integer, b As Integer) As Color
Parameters
The Red component (from 0 to 255).
The Green component (from 0 to 255).
The Blue component (from 0 to 255).
Returns
A new color instance from the specified Red, Green and Blue components.
FromRgb(Int32, Int32, Int32, Double)
Creates a new color instance from the specified Red, Green and Blue components and transparency.
public static Color FromRgb(int r, int g, int b, double transparency)
Public Shared Function FromRgb(r As Integer, g As Integer, b As Integer, transparency As Double) As Color
Parameters
The Red component (from 0 to 255).
The Green component (from 0 to 255).
The Blue component (from 0 to 255).
transparency
- Double
The transparency (0 = fully opaque, 1 = fully transparent).
Returns
A new color instance from the specified Red, Green and Blue components and transparency.
GetHashCode()
Returns a hash code for this Color instance.
Returns
Overrides
ToString()
Returns
Overrides
Operators
Equality(Color, Color)
Determines whether first
and second
Colors are equal.
public static bool operator ==(Color first, Color second)
Public Shared Operator =(first As Color, second As Color) As Boolean
Parameters
first
- Color
The first color.
second
- Color
The second color.
Returns
true if first
and second
colors are equal; otherwise, false.
Inequality(Color, Color)
Determines whether first
and second
Colors are not equal.
public static bool operator !=(Color first, Color second)
Public Shared Operator <>(first As Color, second As Color) As Boolean
Parameters
first
- Color
The first color.
second
- Color
The second color.
Returns
true if first
and second
colors are not equal; otherwise, false.