Note: This solution, although produces a valid HTML color value, that value doesn't necessarily have to be an RGB hex string as explained below. It's also significantly slower than my other solution.
A third solution would be to use the ColorTranslator class, which works because:
- The - ColorTranslator.FromHtml()method uses- ColorConverter.ConvertFrominternally (which can parse ARGB hex values).
 
- The - ColorTranslator.ToHtmlthen just ignores the alpha value and only uses the RGB values to generate the string1.
 
Example:
Color c = ColorTranslator.FromHtml("#FFFF0000");
string rgb = ColorTranslator.ToHtml(c);
And here's some test code to show that this solution will work with all possible ARGB hex values:
try
{
    // Incrementing by 5 to save time. We can use `++` to cover all possible values
    // but it will take a long time to execute.
    for (int a = 0; a <= 255; a += 5)
        for (int r = 0; r <= 255; r += 5)
            for (int g = 0; g <= 255; g += 5)
                for (int b = 0; b <= 255; b += 5)
                    ColorTranslator.FromHtml($"#{a.ToString("X2")}{r.ToString("X2")}" +
                                             $"{g.ToString("X2")}{b.ToString("X2")}");
    Console.WriteLine("All is good!");
}
catch (FormatException ex)
{
    Console.WriteLine($"Failed. Message='{ex.Message}'");
}
1However, keep in mind that ColorTranslator.ToHtml() will not necessarily return an RGB hex string. It tries to return a color name if the color has a known color name (which works for HTML), otherwise, it resorts to RGB hex values in the format of #RRGGBB.