struct Color

book_4_sparkGenerated
code_blocksInput

Description

The Color struct represents a color using four floating-point values (red, green, blue, and alpha) within a 0-1 range. It provides various methods and properties to manipulate and retrieve color information.

Members

Static Members

Member NameSummary
MinReturns the minimum color between two colors.
MaxReturns the maximum color between two colors.
AverageCalculates the average color from an array of colors.
LerpLinearly interpolates between two colors.
FromBytesCreates a color from byte values.
FromRgbCreates a color from an RGB integer.
FromRgbaCreates a color from an RGBA integer.
ParseParses a string to a color.
TryParseTries to parse a string to a color.
RandomReturns a random color from a set of preset colors.

Instance Members

Member NameSummary
WithAlphaReturns a new color with the specified alpha value.
WithAlphaMultipliedReturns a new color with the alpha value multiplied by a factor.
WithRedReturns a new color with the specified red value.
WithGreenReturns a new color with the specified green value.
WithBlueReturns a new color with the specified blue value.
ToHsvConverts this color to HSV format.
ToColor32Converts this color to a 32-bit color.
AdjustHueAdjusts the hue of the color by a specified amount.
DarkenDarkens the color by a specified fraction.
LightenLightens the color by a specified fraction.
InvertReturns the inverted color, keeping alpha unchanged.
DesaturateDesaturates the color by a specified fraction.
SaturateSaturates the color by a specified fraction.
ComponentCountChangedBetweenColorsChecks the component count change between two colors.

Properties

Property NameSummary
LuminanceReturns the grayscale value of the color.
IsRepresentableInHexIndicates if the color can be represented in hexadecimal format.
IsSdrIndicates if all components are between 0 and 1.
IsHdrIndicates if any component exceeds 1.
HexString representation in "#RRGGBB[AA]" format.
RgbaString representation in CSS rgba function notation.
RgbString representation in CSS rgb function notation.
RgbaIntInteger representation in 0xRRGGBBAA format.
RgbIntInteger representation in 0xRRGGBB format.
RawIntInteger representation in 0xAABBGGRR format.
ItemAccesses color components by index.

Fields

Field NameSummary
rThe red component, can exceed 0-1 range.
gThe green component, can exceed 0-1 range.
bThe blue component, can exceed 0-1 range.
aThe alpha component, can exceed 0-1 range.
WhiteFully opaque white color.
GrayFully opaque gray color.
BlackFully opaque black color.
RedFully opaque red color.
GreenFully opaque green color.
BlueFully opaque blue color.
YellowFully opaque yellow color.
OrangeFully opaque orange color.
CyanFully opaque cyan color.
MagentaFully opaque magenta color.
TransparentFully transparent color.