Argb32Color

Argb32Color structure

Represents 32-bit color in ARGB format, with 8 bits per every channel (Alpha, Red, Green, Blue). Supports transparency.

public struct Argb32Color : IEquatable<>, IEquatable<Argb32Color>, IEquatable<Rgb24Color>

Properties

Name Description
A { get; } Gets the alpha part of the color as 8-bit unsigned integer [0..255]
Alpha { get; } Gets the alpha part of the color in percent in (0..1) range.
B { get; } Gets the blue part of the color as 8-bit unsigned integer [0..255]
G { get; } Gets the green part of the color as 8-bit unsigned integer [0..255]
IsEmpty { get; } Indicates whether this Argb32Color color instance is uninitialized - all 4 channels are set to 0. Same as Default and Transparent. Same as IsDefault
IsFullyOpaque { get; } Indicates whether this Argb32Color instance is fully opaque, without transparency (its Alpha channel has max value)
IsFullyTransparent { get; } Indicates whether this Argb32Color instance is fully transparent - its Alpha channel has the min (0) value, so other R, G, and B channels has no visible effect.
IsTranslucent { get; } Indicates whether this Argb32Color instance is translucent (not fully transparent, but also not fully opaque)
R { get; } Gets the red part of the color as 8-bit unsigned integer [0..255]
Value { get; } Gets the Int32 value of the color as 32-bit signed integer

Methods

Name Description
static FromArgb(int) Creates a Argb32Color instance from its 32-bit component (alpha, red, green, and blue) values, compatible with value, produced by the System.Drawing.Color.ToArgb() method
static FromOtherWithAlpha(Argb32Color, byte) Creates a new Argb32Color instance from specified, but with re-defined alpha (opacity) value
static FromOtherWithAlpha(Rgb24Color, byte) Creates a new Argb32Color instance from specified Rgb24Color, but with specified alpha (opacity) value
static FromRgb(byte, byte, byte) Creates one Argb32Color value from specified Red, Green, Blue channels, while Alpha channel is fully opaque
static FromRgba(byte, byte, byte, byte) Creates one Argb32Color value from specified Red, Green, Blue, and Alpha channels
static FromSingleValueRgb(byte) Creates a fully opaque (A=255) color from single value, which will be applied to all channels
Equals(Argb32Color) Checks this color with specified Argb32Color color for equality
override Equals(object) Tests if another object is equal to this Argb32Color instance.
Equals(Rgb24Color) Checks this color with specified Rgb24Color color for equality
GetBrightness() Returns the Hue-Saturation-Lightness (HSL) lightness/brightness for this Argb32Color instance.
override GetHashCode() Returns a hash code that defines the current color. Not compatible with GetHashCode
GetHue() Returns the Hue-Saturation-Lightness (HSL) hue value, in degrees, for this Argb32Color instance. If R == G == B, the hue is meaningless, and the return value is 0.
GetSaturation() The Hue-Saturation-Lightness (HSL) saturation for this Argb32Color instance
ToArgb() Returns the ARGB value of this Argb32Color instance, compatible with System.Drawing.Color.ToArgb() method
ToRGB() Serializes this Argb32Color instance to the ‘rgb’ CSS function notation. Alpha channel of this color will be omitted during serialization.
ToRGBA() Serializes this Argb32Color instance to the ‘rgba’ CSS function notation
override ToString() Serializes this Argb32Color instance to the most appropriate CSS function notation depending on translucency
operator == Compares two Argb32Color colors and returns a boolean indicating if the two do match. (2 operators)
explicit operator Explicitly casts the 32-bit Argb32Color to 24-bit Rgb24Color. Alpha channel of the source Argb32Color will be lost after casting, because Rgb24Color does not support transparency.
implicit operator Implicitly casts the 24-bit Rgb24Color to 32-bit Argb32Color. Alpha channel of the output Argb32Color will be set to 255 - fully opaque.
operator != Compares two Argb32Color colors and returns a boolean indicating if the two do not match. (2 operators)

Fields

Name Description
static readonly Empty Returns an empty color, which has no channels info and is fully transparent. Same as ‘Transparent’. Default value.
static readonly Transparent Fully transparent empty color. The same as default ‘Empty’ color value.

Remarks

This type is designed to be useful for (but not limited to) CSS operations. See more: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value

See Also