Returns an HTML #XXXXXX format for a color.
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Collections.Generic;
public static class Utilities
{
public static string ColorToHtml(Color c)
{
return "#" + c.R.ToString("X2", null) + c.G.ToString("X2", null) + c.B.ToString("X2", null);
}
}
Related examples in the same category