C # Color Values โ€‹โ€‹R, G, B

Where can I find a list of all C # color constants and related values โ€‹โ€‹of R, G, B (red, green, blue)?

eg.

Color.White == (255,255,255)

.Black color == (0,0,0)

etc...

+7
c # colors rgb system.drawing.color
source share
3 answers

Run this program:

using System; using System.Drawing; using System.Reflection; public class Test { static void Main() { var props = typeof(Color).GetProperties(BindingFlags.Public | BindingFlags.Static); foreach (PropertyInfo prop in props) { Color color = (Color) prop.GetValue(null, null); Console.WriteLine("Color.{0} = ({1}, {2}, {3})", prop.Name, color.R, color.G, color.B); } } } 

Or alternatively:

 using System; using System.Drawing; public class Test { static void Main() { foreach (KnownColor known in Enum.GetValues(typeof(KnownColor))) { Color color = Color.FromKnownColor(known); Console.WriteLine("Color.{0} = ({1}, {2}, {3})", known, color.R, color.G, color.B); } } } 
+23
source share

This page seems to have it all.

+9
source share
+5
source share

All Articles