System.UInt32 RgbInt { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The RgbInt property of the Color32 struct provides an integer representation of the color in the format 0xRRGGBB. This format is useful for operations that require a compact representation of the color without the alpha component.

Usage

Use the RgbInt property to retrieve or set the RGB components of a Color32 instance as a single unsigned integer. This can be particularly useful when interfacing with systems or APIs that require color data in this format.

Example

// Example of using the RgbInt property
Color32 color = new Color32 { r = 255, g = 165, b = 0, a = 255 }; // Orange color
uint rgbValue = color.RgbInt;

// Output the integer representation
// rgbValue will be 0xFFA500

// Set the color using an integer
color.RgbInt = 0x00FF00; // Set to green

// Access individual components
byte red = color.r;   // 0
byte green = color.g; // 255
byte blue = color.b;  // 0