Description
The Color.FromRgb
method creates a new Color
instance from a 32-bit unsigned integer representing the RGB components. The 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 (1.0).
Usage
Use this method when you have a color represented as a 32-bit integer and you want 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 integer-based color representations.
Example
// Example of using Color.FromRgb
uint rgbValue = 0xFF5733; // Represents a color with red, green, and blue components
Color color = Color.FromRgb(rgbValue);
// The resulting color will have the following components:
// Red: 1.0 (255/255)
// Green: 0.341 (87/255)
// Blue: 0.2 (51/255)
// Alpha: 1.0 (fully opaque)