static Color FromRgba( System.UInt32 rgba )

book_4_sparkGenerated
code_blocksInput

Description

The Color.FromRgba method creates a Color instance from a 32-bit unsigned integer representing the RGBA color components. The integer is expected to be in the format 0xRRGGBBAA, where each pair of hexadecimal digits represents the red, green, blue, and alpha components of the color, respectively.

Usage

Use this method when you have a color represented as a 32-bit unsigned integer and you need to convert it to a Color object. This is particularly useful when dealing with color data stored in a compact format, such as in graphics programming or when interfacing with APIs that use this format.

Example

// Example of using Color.FromRgba
uint rgbaValue = 0xFF00FF80; // Purple color with 50% transparency
Color color = Color.FromRgba(rgbaValue);

// Accessing the color components
float red = color.r;   // 1.0
float green = color.g; // 0.0
float blue = color.b;  // 1.0
float alpha = color.a; // 0.5