Show / Hide Table of Contents

Struct ColorInt

Color, as int in 0xAARRGGBB format. Can convert from/to System.Drawing.Color, System.Windows.Media.Color, int (0xAARRGGBB), Windows COLORREF (0xBBGGRR), string.

public record struct ColorInt : IEquatable<ColorInt>

Namespace: Au.Types
Assembly: Au.dll

Constructors

Name Description
ColorInt(int, bool?)
ColorInt(uint, bool?)

Fields

Name Description
argb

Color value in 0xAARRGGBB format.

Methods

Name Description
FromBGR(int, bool?)

Converts from Windows native COLORREF (0xBBGGRR to 0xAARRGGBB).

FromHLS(int, int, int, bool)

Converts from hue-luminance-saturation (HLS).

FromString(string, out ColorInt)

Converts from a color name (System.Drawing.Color.FromName) or string "0xRRGGBB" or "#RRGGBB".

GetPerceivedBrightness(int, bool)

Calculates color's perceived brightness.

SwapRB(int)

Converts color from ARGB (0xAARRGGBB) to ABGR (0xAABBGGRR) or vice versa (swaps the red and blue bytes). ARGB is used in .NET, GDI+ and HTML/CSS. ABGR is used by most Windows API; aka COLORREF.

SwapRB(uint)

Converts color from ARGB (0xAARRGGBB) to ABGR (0xAABBGGRR) or vice versa (swaps the red and blue bytes). ARGB is used in .NET, GDI+ and HTML/CSS. ABGR is used by most Windows API; aka COLORREF.

ToBGR(bool)

Converts to Windows native COLORREF (0xBBGGRR from 0xAARRGGBB).

ToHLS(int, bool)

Converts to hue-luminance-saturation (HLS).

ToString()

Operators

Name Description
explicit operator Color(ColorInt)

Converts to System.Drawing.Color.

explicit operator Color(ColorInt)

Converts to System.Windows.Media.Color.

implicit operator ColorInt(Color)

Converts from System.Drawing.Color.

implicit operator ColorInt(int)

Converts from an int color value in 0xRRGGBB or 0xAARRGGBB format. Sets alpha = 0xFF if it is 0 in color.

implicit operator ColorInt(uint)

Converts from an uint color value in 0xRRGGBB or 0xAARRGGBB format. Sets alpha = 0xFF if it is 0 in color.

implicit operator ColorInt(Color)

Converts from System.Windows.Media.Color.