Description
The FromRgba
method is a static method of the Color32
struct that creates a Color32
instance from a 32-bit unsigned integer representing a color in RGBA format. The integer is expected to be in the form 0xRRGGBBAA
, where each pair of hexadecimal digits represents the red, green, blue, and alpha components of the color, respectively.
Usage
To use the FromRgba
method, pass a 32-bit unsigned integer that encodes the desired color in RGBA format. The method will return a Color32
instance representing that color.
Example
// Example of using Color32.FromRgba
uint rgbaValue = 0xFF00FF00; // Represents a green color with full opacity
Color32 color = Color32.FromRgba(rgbaValue);
// Accessing the color components
byte red = color.r; // 0
byte green = color.g; // 255
byte blue = color.b; // 0
byte alpha = color.a; // 255