Is there a .NET list of 256 colors only?
The Colors class exposes too complicated properties (i.e. beige and other column I don't need).
I only want a list of the main colors, or at least the list should be ordered by extremeness,开发者_运维技巧 i.e. should first contain the explicit colors like black, white, red, green, blue, then should go to more complex combinations like yello, orange, purple, etc.
Update
Related: Generate a specific color for each string?
There's actually a few 256 color configurations.
I can't think of any .NET libraries that contain these colors; you'll probably either have to generate the colors yourself or parse these pages using some tricky copy/paste and search/replace to hard code them.
The VGA palette is sort of the one that's the most "native" to the PC industry:
http://en.wikipedia.org/wiki/VGA#The_VGA_color_palette
You can also programmatically generate an 8 bit truecolor palette:
http://en.wikipedia.org/wiki/8-bit_color
The 216 color web palette might also suit your needs:
http://www.pagetutor.com/common/bgcolors216.html
http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors
Edit: Color extremeness is sort of a dark art actually, perceptual color extremeness doubly so.
You might come up with a scheme to sample the HSB chart at the correct intervals, but extremity is a one-dimensional concept, and HSB is a three-dimensional chart... so I'm not too sure how you'd do it.
I don't think there is any agreed-upon definition of what are "main" colors, if you want a collection of only certain colors you will have to define them yourself. Also, the .Net Colors are not ordered, so you will have to create your own ordered collection to get certain colors "before" others.
The html "safe" colors are to set RGB values each to 0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF . This only sucks up 216 colors, the other 40 being reserved for "system" colors. This is highly irrelevant today, but is usually what people used to think of as the main 256 colors as far as the web was concerned. See for example W3Schools Html Colors. Note that the css colorlist suggested by W3 Schools is not made up of "safe" colors.
精彩评论