2013年4月23日 星期二

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
1 
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

1 則留言:

  1. 菩薩慈悲:非常實用,末學已用上。感恩感恩 讚歎讚歎 南無阿彌陀佛
    https://github.com/oscarsun72/TextForCtext/commit/9b5f8c0651d834926ac0120873d3b39c58733a17#diff-2bb79072a7c92a916140a0504bc56c61da3877442c84043fce6972c3a0421733L4775

    回覆刪除