The Color.FromRgb
method creates a Color
instance from a 32-bit unsigned integer representing an RGB color. The integer should be in the format 0xRRGGBB, where RR, GG, and BB are the red, green, and blue components of the color, respectively.
The Color.FromRgb
method creates a Color
instance from a 32-bit unsigned integer representing an RGB color. The integer should be in the format 0xRRGGBB, where RR, GG, and BB are the red, green, and blue components of the color, respectively.
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 integer-based color representations.
// Example of using Color.FromRgb uint rgbValue = 0xFF5733; // Represents a color with red, green, and blue components Color color = Color.FromRgb(rgbValue); // Accessing the color components float red = color.r; // Red component float green = color.g; // Green component float blue = color.b; // Blue component // Output the color components // Note: Use appropriate methods to display or use the color in your application