struct Color

book_4_sparkGenerated
code_blocksInput

Description

The Color struct represents a color using four floating-point values (red, green, blue, and alpha) each ranging from 0 to 1. This struct 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 a 32-bit RGB value.
FromRgbaCreates a color from a 32-bit RGBA value.
ParseParses a color from a string.
TryParseTries to parse a color from a string.
RandomReturns a random color from a set of preset colors.
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.

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.
LerpToInterpolates this color towards a target 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.
DesaturateDesaturates the color by a specified fraction.
SaturateSaturates the color by a specified fraction.
ComponentCountChangedBetweenColorsReturns the number of components that changed between two colors.
LuminanceReturns the luminance 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 hexadecimal format.
RgbaString representation in CSS rgba format.
RgbString representation in CSS rgb format.
RgbaIntInteger representation in RGBA format.
RgbIntInteger representation in RGB format.
RawIntInteger representation in native format.
ItemAccesses the color component by index.
rThe red color component.
gThe green color component.
bThe blue color component.
aThe alpha color component.