Color - ToHtml

Translates the specified structure to an HTML string color representation.

Try it

public static void Main()
{
    Color myColor = Color.Red;
    
	//C# Extension Method: Color - ToHtml
	string htmlColor = myColor.ToHtml();
	Console.WriteLine(htmlColor);
}

View Source
using System;
#if !NETSTANDARD
using System.Drawing;
#endif

public static partial class Extensions
{
#if !NETSTANDARD
    /// <summary>
    ///     Translates the specified  structure to an HTML string color representation.
    /// </summary>
    /// <param name="c">The  structure to translate.</param>
    /// <returns>The string that represents the HTML color.</returns>
    public static String ToHtml(this Color c)
    {
        return ColorTranslator.ToHtml(c);
    }
#endif
}