System.Drawing.Color标准颜色值

从System.Drawing.Color获取所有的命名的标准颜色对应的RGB值

System.Drawing.Color类中定义了一系列的命名颜色和一系列的有关颜色的方法。我们如何从这个类中提取它们呢?并且想知道他们这命名的颜色对应的RGB是多少呢?

public static IList GetAllColors()

        {

            Type type = typeof(Color);

            PropertyInfo[] props = type.GetProperties(BindingFlags.Public | BindingFlags.Static);

            return props.Select(s => s.GetValue(null)).Select(s => (Color)s).ToList();

        }

这样你就可以循环遍历输出它们的R、G、B值了。

详细的114中颜色的hex值

你可能感兴趣的:(System.Drawing.Color标准颜色值)