C#颜色和名称样式对照表

来自:http://www.cnblogs.com/xiaofengfeng/archive/2010/10/06/1844601.html


这篇文章来来源于C# Color Table,这里是我翻译的中文版本,其中已经加上了我的一些理解和注释。翻译这篇文章的原因是我在写C#程序的时候发现,C#自带的颜色种类极多(详见下表),如果没有直观的对照关系的话,很难从那么多的名
 这篇文章来来源于C# Color Table,这里是我翻译的中文版本,其中已经加上了我的一些理解和注释。翻译这篇文章的原因是我在写C#程序的时候发现,C#自带的颜色种类极多(详见下表),如果没有直观的对照关系的话,很难从那么多的名字中挑选出中意的颜色。 
以下的颜色代码取自HTML规范,这些颜色的名称对应于KnownColor的属性。比如,你可以用以下代码来创建一个Color对象:

Color c = Color.FromKnownColor(KnownColor.colorname);
所有的colorname在后面的表格中一一列出,这些颜色对应的RGB值列在名字的后面,你可以使用FromArgb方法来创建Color对象。以下两行实际上创建了同一种颜色:

Color c1 = Color.FromArgb(32,178,170);
Color c2 = Color.FromKnownColor(KnownColor.LightSeaGreen);
在下面这张表中,我严格依照颜色的RGB值设置对应颜色的显示。你所看到的真实效果依赖于浏览器是否准确处理了对应24位色的颜色显示(一些浏览器可能将某些颜色映射成“最接近的网页调色板颜色”),显示器的调节或者你显卡的校正值。因此显示效果会略有不同。

补充:

还有一些获取颜色的方式:

Color c1 = Color.AliceBlue;            //Color类自带的静态颜色对象Color c2 = Color.FromArgb(0x20B2AA);   //网页里面提取的颜色(原格式为#20B2AA)

C#颜色和名称对照表

A B C D E F G H I J K L M 
N O P Q R S T U V W X Y Z


Color.AliceBlue
240,248,255
Color.LightSalmon
255,160,122
Color.AntiqueWhite
250,235,215
Color.LightSeaGreen
32,178,170
Color.Aqua
0,255,255
Color.LightSkyBlue
135,206,250
Color.Aquamarine
127,255,212
Color.LightSlateGray
119,136,153
Color.Azure
240,255,255
Color.LightSteelBlue
176,196,222
Color.Beige
245,245,220
Color.LightYellow
255,255,224
Color.Bisque
255,228,196
Color.Lime
0,255,0
Color.Black
0,0,0
Color.LimeGreen
50,205,50
Color.BlanchedAlmond
255,255,205
Color.Linen
250,240,230
Color.Blue
0,0,255
Color.Magenta
255,0,255
Color.BlueViolet
138,43,226
Color.Maroon
128,0,0
Color.Brown
165,42,42
Color.MediumAquamarine
102,205,170
Color.BurlyWood
222,184,135
Color.MediumBlue
0,0,205
Color.CadetBlue
95,158,160
Color.MediumOrchid
186,85,211
Color.Chartreuse
127,255,0
Color.MediumPurple
147,112,219
Color.Chocolate
210,105,30
Color.MediumSeaGreen
60,179,113
Color.Coral
255,127,80
Color.MediumSlateBlue
123,104,238
Color.CornflowerBlue
100,149,237
Color.MediumSpringGreen
0,250,154
Color.Cornsilk
255,248,220
Color.MediumTurquoise
72,209,204
Color.Crimson
220,20,60
Color.MediumVioletRed
199,21,112
Color.Cyan
0,255,255
Color.MidnightBlue
25,25,112
Color.DarkBlue
0,0,139
Color.MintCream
245,255,250
Color.DarkCyan
0,139,139
Color.MistyRose
255,228,225
Color.DarkGoldenrod
184,134,11
Color.Moccasin
255,228,181
Color.DarkGray
169,169,169
Color.NavajoWhite
255,222,173
Color.DarkGreen
0,100,0
Color.Navy
0,0,128
Color.DarkKhaki
189,183,107
Color.OldLace
253,245,230
Color.DarkMagena
139,0,139
Color.Olive
128,128,0
Color.DarkOliveGreen
85,107,47
Color.OliveDrab
107,142,45
Color.DarkOrange
255,140,0
Color.Orange
255,165,0
Color.DarkOrchid
153,50,204
Color.OrangeRed
255,69,0
Color.DarkRed
139,0,0
Color.Orchid
218,112,214
Color.DarkSalmon
233,150,122
Color.PaleGoldenrod
238,232,170
Color.DarkSeaGreen
143,188,143
Color.PaleGreen
152,251,152
Color.DarkSlateBlue
72,61,139
Color.PaleTurquoise
175,238,238
Color.DarkSlateGray
40,79,79
Color.PaleVioletRed
219,112,147
Color.DarkTurquoise
0,206,209
Color.PapayaWhip
255,239,213
Color.DarkViolet
148,0,211
Color.PeachPuff
255,218,155
Color.DeepPink
255,20,147
Color.Peru
205,133,63
Color.DeepSkyBlue
0,191,255
Color.Pink
255,192,203
Color.DimGray
105,105,105
Color.Plum
221,160,221
Color.DodgerBlue
30,144,255
Color.PowderBlue
176,224,230
Color.Firebrick
178,34,34
Color.Purple
128,0,128
Color.FloralWhite
255,250,240
Color.Red
255,0,0
Color.ForestGreen
34,139,34
Color.RosyBrown
188,143,143
Color.Fuschia
255,0,255
Color.RoyalBlue
65,105,225
Color.Gainsboro
220,220,220
Color.SaddleBrown
139,69,19
Color.GhostWhite
248,248,255
Color.Salmon
250,128,114
Color.Gold
255,215,0
Color.SandyBrown
244,164,96
Color.Goldenrod
218,165,32
Color.SeaGreen
46,139,87
Color.Gray
128,128,128
Color.Seashell
255,245,238
Color.Green
0,128,0
Color.Sienna
160,82,45
Color.GreenYellow
173,255,47
Color.Silver
192,192,192
Color.Honeydew
240,255,240
Color.SkyBlue
135,206,235
Color.HotPink
255,105,180
Color.SlateBlue
106,90,205
Color.IndianRed
205,92,92
Color.SlateGray
112,128,144
Color.Indigo
75,0,130
Color.Snow
255,250,250
Color.Ivory
255,240,240
Color.SpringGreen
0,255,127
Color.Khaki
240,230,140
Color.SteelBlue
70,130,180
Color.Lavender
230,230,250
Color.Tan
210,180,140
Color.LavenderBlush
255,240,245
Color.Teal
0,128,128
Color.LawnGreen
124,252,0
Color.Thistle
216,191,216
Color.LemonChiffon
255,250,205
Color.Tomato
253,99,71
Color.LightBlue
173,216,230
Color.Turquoise
64,224,208
Color.LightCoral
240,128,128
Color.Violet
238,130,238
Color.LightCyan
224,255,255
Color.Wheat
245,222,179
Color.LightGoldenrodYellow
250,250,210
Color.White
255,255,255
Color.LightGreen
144,238,144
Color.WhiteSmoke
245,245,245
Color.LightGray
211,211,211
Color.Yellow
255,255,0
Color.LightPink
255,182,193
Color.YellowGreen
154,205,50

附C#颜色代码生成工具方便大家本地查看:

 
本篇文章来源于:开发学院 http://edu.codepub.com   原文链接:http://edu.codepub.com/2009/0601/5153.php




展开阅读全文

c#颜色名称对照表

11-23

最近老是设置颜色,又搞不清微软的颜色什么样子,就写了这个。rnrn本身没什么技术含量rn只是方便有需要的朋友。rnrn[code=C#]using System;rnusing System.Collections.Generic;rnusing System.ComponentModel;rnusing System.Data;rnusing System.Drawing;rnusing System.Linq;rnusing System.Text;rnusing System.Windows.Forms;rnusing System.Collections;rnrnnamespace csharp颜色对照表rnrn public partial class Form1 : Formrn rn int i = 0;rn public Form1()rn rn InitializeComponent();rn rnrn private void Form1_Shown(object sender, EventArgs e)rn rn rn string cl_m="Color.AliceBlue,Color.AntiqueWhite,Color.Aqua,Color.Aquamarine,Color.Azure,Color.Beige,"rn +"Color.Bisque,Color.Black,Color.BlanchedAlmond,Color.Blue,Color.BlueViolet,Color.Brown,"rn +"Color.BurlyWood,Color.CadetBlue,Color.Chartreuse,Color.Chocolate,Color.Coral,Color.CornflowerBlue,"rn +"Color.Cornsilk,Color.Crimson,Color.Cyan,Color.DarkBlue,Color.DarkCyan,Color.DarkGoldenrod,"rn +"Color.DarkGray,Color.DarkGreen,Color.DarkKhaki,Color.DarkMagenta,Color.DarkOliveGreen,Color.DarkOrange,"rn +"Color.DarkOrchid,Color.DarkRed,Color.DarkSalmon,Color.DarkSeaGreen,Color.DarkSlateBlue,"rn +"Color.DarkSlateGray,Color.DarkTurquoise,Color.DarkViolet,Color.DeepPink,Color.DeepSkyBlue,Color.DimGray,"rn +"Color.DodgerBlue,Color.Empty,Color.Firebrick,Color.FloralWhite,Color.ForestGreen,Color.Fuchsia,"rn +"Color.Gainsboro,Color.GhostWhite,Color.Gold,Color.Goldenrod,Color.Gray,Color.Green,Color.GreenYellow,"rn +"Color.Honeydew,Color.HotPink,Color.IndianRed,Color.Indigo,Color.Ivory,Color.Khaki,Color.Lavender,"rn +"Color.LavenderBlush,Color.LawnGreen,Color.LemonChiffon,Color.LightBlue,Color.LightCoral,Color.LightCyan,"rn +"Color.LightGoldenrodYellow,Color.LightGray,Color.LightGreen,Color.LightPink,Color.LightSalmon,"rn +"Color.LightSeaGreen,Color.LightSkyBlue,Color.LightSlateGray,Color.LightSteelBlue,Color.LightYellow,"rn +"Color.Lime,Color.LimeGreen,Color.Linen,Color.Magenta,Color.Maroon,Color.MediumAquamarine,"rn +"Color.MediumBlue,Color.MediumOrchid,Color.MediumPurple,Color.MediumSeaGreen,Color.MediumSlateBlue,"rn +"Color.MediumSpringGreen,Color.MediumTurquoise,Color.MediumVioletRed,Color.MidnightBlue,Color.MintCream,"rn +"Color.MistyRose,Color.Moccasin,Color.NavajoWhite,Color.Navy,Color.OldLace,Color.Olive,Color.OliveDrab,"rn +"Color.Orange,Color.OrangeRed,Color.Orchid,Color.PaleGoldenrod,Color.PaleGreen,Color.PaleTurquoise,"rn +"Color.PaleVioletRed,Color.PapayaWhip,Color.PeachPuff,Color.Peru,Color.Pink,Color.Plum,Color.PowderBlue,"rn +"Color.Purple,Color.Red,Color.RosyBrown,Color.RoyalBlue,Color.SaddleBrown,Color.Salmon,Color.SandyBrown,"rn +"Color.SeaGreen,Color.SeaShell,Color.Sienna,Color.Silver,Color.SkyBlue,Color.SlateBlue,Color.SlateGray,"rn +"Color.Snow,Color.SpringGreen,Color.SteelBlue,Color.Tan,Color.Teal,Color.Thistle,Color.Tomato,Color.Transparent,"rn +"Color.Turquoise,Color.Violet,Color.Wheat,Color.White,Color.WhiteSmoke,Color.Yellow,Color.YellowGreen";rnrn char[] chr = ',' ;rn string[] str_color = cl_m.Split(chr, StringSplitOptions.RemoveEmptyEntries);rn rn foreach (string str in str_color)rn rn richTextBox1.Font = new Font("微软雅黑", 12);rn richTextBox1.SelectionColor = Color.FromName(str.Substring(6, (str.Length - 6)));rn richTextBox1.SelectedText = str;rn richTextBox1.AppendText("\n");rn rn rn rn rn rn rn private void button1_Click(object sender, EventArgs e)rn rn rn switch (i)rn rn case 0:rn rn richTextBox1.BackColor = Color.White;rn i++;rn break;rn rn case 1:rn rn richTextBox1.BackColor = Color.Red;rn i++;rn break;rn rn case 2:rn rn richTextBox1.BackColor = Color.Blue;rn i++;rn break;rn rn case 3:rn rn richTextBox1.BackColor = Color.Green;rn i++;rn break;rn rn rn default:rn rn richTextBox1.BackColor = Color.Black;rn i=0;rn break;rn rn rn rn rn rnrn[/code]rn 论坛

没有更多推荐了,返回首页