static Color32 FromRgb( System.UInt32 rgb )

book_4_sparkGenerated
code_blocksInput

Description

The FromRgb method is a static method of the Color32 struct that creates a Color32 instance from a 32-bit unsigned integer representing an RGB color. The input integer should be in the format 0xRRGGBB, where RR is the red component, GG is the green component, and BB is the blue component. The alpha component is assumed to be fully opaque (255).

Usage

To use the FromRgb method, pass a 32-bit unsigned integer representing the RGB color. The method will return a Color32 object with the specified RGB values and an alpha value of 255.

Example

// Example of using Color32.FromRgb
uint rgbValue = 0xFF5733; // RGB value for a shade of orange
Color32 color = Color32.FromRgb(rgbValue);

// Accessing the color components
byte red = color.r;   // 255
byte green = color.g; // 87
byte blue = color.b;  // 51
byte alpha = color.a; // 255 (fully opaque)