rgb = "FFFFFF";
var result = Regex.Matches(rgb, @"\w{2}");
List<string> re = new List<string>();
foreach (Match item in result)
{
re.Add(item.Value);
}
byte r = (byte)Convert.ToByte(re[0], 16);
byte g = (byte)Convert.ToByte(re[1], 16);
byte b = (byte)Convert.ToByte(re[2], 16);
Color32 color = new Color32(r, g, b, 255);
转载于:https://blog.51cto.com/9575485/1718744