struct Color

robot_2Generated
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 to manipulate and convert colors, as well as properties to access color components and representations.

Members

Static Members

Member NameSummary
MinReturns the minimum color by comparing two colors.
MaxReturns the maximum color by comparing two colors.
AverageCalculates the average color from an array of colors.
LerpLinearly interpolates between two colors.
FromBytesCreates a color from byte values for red, green, blue, and alpha.
FromRgbCreates a color from a 32-bit RGB value.
FromRgbaCreates a color from a 32-bit RGBA value.
ParseParses a color from a string representation.
TryParseTries to parse a color from a string representation.
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, keeping alpha unchanged.
DesaturateDesaturates the color by a specified fraction.
SaturateSaturates the color by a specified fraction.
ComponentCountChangedBetweenColorsChecks if the component count has changed between two colors.
LuminanceReturns the luminance of the color, representing its grayscale value.
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 of the color in hexadecimal format.
RgbaString representation in CSS rgba function notation.
RgbString representation in CSS rgb function notation.
RgbaIntInteger representation of the color in RGBA format.
RgbIntInteger representation of the color in RGB format.
RawIntInteger representation of the color as used by native code.
ItemAccesses the color component by index.
rThe red color component, which can exceed the 0-1 range.
gThe green color component, which can exceed the 0-1 range.
bThe blue color component, which can exceed the 0-1 range.
aThe alpha component, representing transparency, which can exceed the 0-1 range.