Rgb24Color

Rgb24Color structure

Represents 24-bit color in RGB format, with 8 bits per every channel (Red, Green, Blue). Does not support transparency.

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

Properties

Name Description
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]
IsDefault { get; } Indicates whether this Rgb24Color instance is default (Black) - all 3 channels are set to 0.
R { get; } Gets the red part of the color as 8-bit unsigned integer [0..255]

Methods

Name Description
static FromRgb(byte, byte, byte) Creates one Rgb24Color value from specified Red, Green, Blue channels
Equals(Argb32Color) Checks this color with specified Argb32Color color for equality
override Equals(object) Tests if another object is equal to this Rgb24Color instance.
Equals(Rgb24Color) Checks this color with specified Rgb24Color color for equality
GetBrightness() Returns the Hue-Saturation-Lightness (HSL) lightness/brightness for this Rgb24Color 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 Rgb24Color instance. If R == G == B, the hue is meaningless, and the return value is 0.
GetSaturation() The Hue-Saturation-Lightness (HSL) saturation for this Rgb24Color instance
ToArgb() Returns the ARGB value of this Rgb24Color instance, compatible with Color
ToHex() Returns this color in hexadecimal string representation
ToRGB() Serializes this Rgb24Color instance to the ‘rgb’ CSS function notation.
override ToString() Serializes this Rgb24Color instance to ‘rgb(r, g, b)’ format
operator == Compares two Rgb24Color colors and returns a boolean indicating if the two do match. (2 operators)
operator != Compares two Rgb24Color colors and returns a boolean indicating if the two do not match. (2 operators)

Other Members

Name Description
static class KnownColors Contains all “known colors”, that have fixed unique name and value in CSS standart

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