最近我一直在将Visual Studio(C#)项目转换为网络。 其中一项功能涉及从MS标准调色板中进行选择。
所以我需要一个十六进制的MS标准颜色列表。
答案 0 :(得分:9)
搜索后我找不到这些ARGB颜色的列表,所以我写了一些JS来为我转换它们。
我想我不可能是唯一需要这些的人,所以你走了!
AliceBlue#F0F8FF
AntiqueWhite#FAEBD7
Aqua#00FFFF
海蓝宝石#7FFFD4
Azure#F0FFFF
米色#F5F5DC
Bisque#FFE4C4
黑色#000000
BlanchedAlmond #FFEBCD
蓝色#0000FF
BlueViolet#8A2BE2
布朗#A52A2A
BurlyWood#DEB887
CadetBlue#5F9EA0
Chartreuse#7FFF00
巧克力#D2691E
珊瑚#FF7F50
CornflowerBlue#6495ED
Cornsilk#FFF8DC
Crimson#DC143C
青色#00FFFF
DarkBlue#00008B
DarkCyan#008B8B
DarkGoldenrod#B8860B
DarkGray#A9A9A9
DarkGreen#006400
DarkKhaki#BDB76B
DarkMagenta#8B008B
DarkOliveGreen#556B2F
DarkOrange#FF8C00
DarkOrchid#9932CC
DarkRed#8B0000
DarkSalmon#E9967A
DarkSeaGreen#8FBC8F
DarkSlateBlue#483D8B
DarkSlateGray#2F4F4F
DarkTurquoise#00CED1
DarkViolet#9400D3
DeepPink#FF1493
DeepSkyBlue#00BFFF
DimGray#696969
DodgerBlue#1E90FF
耐火砖#B22222
FloralWhite#FFFAF0
ForestGreen#228B22
紫红色#FF00FF
Gainsboro #DCDCDC
GhostWhite#F8F8FF
黄金#FFD700
Goldenrod#DAA520
格雷#808080
绿色#008000
GreenYellow#ADFF2F
Honeydew#F0FFF0
HotPink#FF69B4
IndianRed#CD5C5C
Indigo#4B0082
Ivory#FFFFF0
卡其色#F0E68C薰衣草#E6E6FA
LavenderBlush#FFF0F5
LawnGreen#7CFC00
LemonChiffon #FFFACD
LightBlue#ADD8E6
LightCoral#F08080
LightCyan#E0FFFF
LightGoldenrodYellow#FAFAD2
LightGray#D3D3D3
LightGreen#90EE90
LightPink#FFB6C1
LightSalmon#FFA07A
LightSeaGreen#20B2AA
LightSkyBlue#87CEFA
LightSlateGray#778899
LightSteelBlue#B0C4DE
LightYellow#FFFFE0
Lime#00FF00
LimeGreen#32CD32
亚麻#FAF0E6
洋红色#FF00FF
栗色#800000
MediumAquamarine#66CDAA
MediumBlue#0000CD
MediumOrchid#BA55D3
MediumPurple#9370DB
MediumSeaGreen#3CB371
MediumSlateBlue#7B68EE
MediumSpringGreen#00FA9A
MediumTurquoise#48D1CC
MediumVioletRed#C71585
MidnightBlue#191970
MintCream#F5FFFA
MistyRose#FFE4E1
Moccasin#FFE4B5
NavajoWhite #FFDEAD
海军#000080
OldLace#FDF5E6
Olive#808000
OliveDrab#6B8E23
Orange#FFA500
OrangeRed#FF4500
Orchid#DA70D6
PaleGoldenrod#EEE8AA
PaleGreen#98FB98
PaleTurquoise #AFEEEE
PaleVioletRed#DB7093
PapayaWhip#FFEFD5
PeachPuff#FFDAB9
秘鲁#CD853F
Pink#FFC0CB
Plum#DDA0DD
PowderBlue#B0E0E6
紫色#800080
红色#FF0000
RosyBrown#BC8F8F
RoyalBlue#4169E1
SaddleBrown#8B4513
Salmon#FA8072
SandyBrown#F4A460
SeaGreen#2E8B57
SeaShell#FFF5EE
Sienna#A0522D
Silver#C0C0C0
SkyBlue#87CEEB
SlateBlue#6A5ACD
SlateGray#708090
Snow #FFFAFA
SpringGreen#00FF7F
SteelBlue#4682B4
Tan#D2B48C
Teal#008080
Thistle#D8BFD8
番茄#FF6347
透明无
Turquoise#40E0D0
紫罗兰#EE82EE
小麦#F5DEB3
白色#FFFFFF
WhiteSmoke#F5F5F5
黄色#FFFF00
YellowGreen#9ACD32
或作为CSS类的块:
.AliceBlue{background-color:#F0F8FF;}
.AntiqueWhite{background-color:#FAEBD7;}
.Aqua{background-color:#00FFFF;}
.Aquamarine{background-color:#7FFFD4;}
.Azure{background-color:#F0FFFF;}
.Beige{background-color:#F5F5DC;}
.Bisque{background-color:#FFE4C4;}
.Black{background-color:#000000;}
.BlanchedAlmond{background-color:#FFEBCD;}
.Blue{background-color:#0000FF;}
.BlueViolet{background-color:#8A2BE2;}
.Brown{background-color:#A52A2A;}
.BurlyWood{background-color:#DEB887;}
.CadetBlue{background-color:#5F9EA0;}
.Chartreuse{background-color:#7FFF00;}
.Chocolate{background-color:#D2691E;}
.Coral{background-color:#FF7F50;}
.CornflowerBlue{background-color:#6495ED;}
.Cornsilk{background-color:#FFF8DC;}
.Crimson{background-color:#DC143C;}
.Cyan{background-color:#00FFFF;}
.DarkBlue{background-color:#00008B;}
.DarkCyan{background-color:#008B8B;}
.DarkGoldenrod{background-color:#B8860B;}
.DarkGray{background-color:#A9A9A9;}
.DarkGreen{background-color:#006400;}
.DarkKhaki{background-color:#BDB76B;}
.DarkMagenta{background-color:#8B008B;}
.DarkOliveGreen{background-color:#556B2F;}
.DarkOrange{background-color:#FF8C00;}
.DarkOrchid{background-color:#9932CC;}
.DarkRed{background-color:#8B0000;}
.DarkSalmon{background-color:#E9967A;}
.DarkSeaGreen{background-color:#8FBC8F;}
.DarkSlateBlue{background-color:#483D8B;}
.DarkSlateGray{background-color:#2F4F4F;}
.DarkTurquoise{background-color:#00CED1;}
.DarkViolet{background-color:#9400D3;}
.DeepPink{background-color:#FF1493;}
.DeepSkyBlue{background-color:#00BFFF;}
.DimGray{background-color:#696969;}
.DodgerBlue{background-color:#1E90FF;}
.Firebrick{background-color:#B22222;}
.FloralWhite{background-color:#FFFAF0;}
.ForestGreen{background-color:#228B22;}
.Fuchsia{background-color:#FF00FF;}
.Gainsboro{background-color:#DCDCDC;}
.GhostWhite{background-color:#F8F8FF;}
.Gold{background-color:#FFD700;}
.Goldenrod{background-color:#DAA520;}
.Gray{background-color:#808080;}
.Green{background-color:#008000;}
.GreenYellow{background-color:#ADFF2F;}
.Honeydew{background-color:#F0FFF0;}
.HotPink{background-color:#FF69B4;}
.IndianRed{background-color:#CD5C5C;}
.Indigo{background-color:#4B0082;}
.Ivory{background-color:#FFFFF0;}
.Khaki{background-color:#F0E68C;}
.Lavender{background-color:#E6E6FA;}
.LavenderBlush{background-color:#FFF0F5;}
.LawnGreen{background-color:#7CFC00;}
.LemonChiffon{background-color:#FFFACD;}
.LightBlue{background-color:#ADD8E6;}
.LightCoral{background-color:#F08080;}
.LightCyan{background-color:#E0FFFF;}
.LightGoldenrodYellow{background-color:#FAFAD2;}
.LightGray{background-color:#D3D3D3;}
.LightGreen{background-color:#90EE90;}
.LightPink{background-color:#FFB6C1;}
.LightSalmon{background-color:#FFA07A;}
.LightSeaGreen{background-color:#20B2AA;}
.LightSkyBlue{background-color:#87CEFA;}
.LightSlateGray{background-color:#778899;}
.LightSteelBlue{background-color:#B0C4DE;}
.LightYellow{background-color:#FFFFE0;}
.Lime{background-color:#00FF00;}
.LimeGreen{background-color:#32CD32;}
.Linen{background-color:#FAF0E6;}
.Magenta{background-color:#FF00FF;}
.Maroon{background-color:#800000;}
.MediumAquamarine{background-color:#66CDAA;}
.MediumBlue{background-color:#0000CD;}
.MediumOrchid{background-color:#BA55D3;}
.MediumPurple{background-color:#9370DB;}
.MediumSeaGreen{background-color:#3CB371;}
.MediumSlateBlue{background-color:#7B68EE;}
.MediumSpringGreen{background-color:#00FA9A;}
.MediumTurquoise{background-color:#48D1CC;}
.MediumVioletRed{background-color:#C71585;}
.MidnightBlue{background-color:#191970;}
.MintCream{background-color:#F5FFFA;}
.MistyRose{background-color:#FFE4E1;}
.Moccasin{background-color:#FFE4B5;}
.NavajoWhite{background-color:#FFDEAD;}
.Navy{background-color:#000080;}
.OldLace{background-color:#FDF5E6;}
.Olive{background-color:#808000;}
.OliveDrab{background-color:#6B8E23;}
.Orange{background-color:#FFA500;}
.OrangeRed{background-color:#FF4500;}
.Orchid{background-color:#DA70D6;}
.PaleGoldenrod{background-color:#EEE8AA;}
.PaleGreen{background-color:#98FB98;}
.PaleTurquoise{background-color:#AFEEEE;}
.PaleVioletRed{background-color:#DB7093;}
.PapayaWhip{background-color:#FFEFD5;}
.PeachPuff{background-color:#FFDAB9;}
.Peru{background-color:#CD853F;}
.Pink{background-color:#FFC0CB;}
.Plum{background-color:#DDA0DD;}
.PowderBlue{background-color:#B0E0E6;}
.Purple{background-color:#800080;}
.Red{background-color:#FF0000;}
.RosyBrown{background-color:#BC8F8F;}
.RoyalBlue{background-color:#4169E1;}
.SaddleBrown{background-color:#8B4513;}
.Salmon{background-color:#FA8072;}
.SandyBrown{background-color:#F4A460;}
.SeaGreen{background-color:#2E8B57;}
.SeaShell{background-color:#FFF5EE;}
.Sienna{background-color:#A0522D;}
.Silver{background-color:#C0C0C0;}
.SkyBlue{background-color:#87CEEB;}
.SlateBlue{background-color:#6A5ACD;}
.SlateGray{background-color:#708090;}
.Snow{background-color:#FFFAFA;}
.SpringGreen{background-color:#00FF7F;}
.SteelBlue{background-color:#4682B4;}
.Tan{background-color:#D2B48C;}
.Teal{background-color:#008080;}
.Thistle{background-color:#D8BFD8;}
.Tomato{background-color:#FF6347;}
.Transparent{background-color:none;}
.Turquoise{background-color:#40E0D0;}
.Violet{background-color:#EE82EE;}
.Wheat{background-color:#F5DEB3;}
.White{background-color:#FFFFFF;}
.WhiteSmoke{background-color:#F5F5F5;}
.Yellow{background-color:#FFFF00;}
.YellowGreen{background-color:#9ACD32;}
将ARGB转换为HEX的代码
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fun /*, thisp*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this)
fun.call(thisp, this[i], i, this);
}
};
}
var colors;
colors = new Array;
colors.push("#FFF0F8FF","#FFFAEBD7","#FF00FFFF","#FF7FFFD4","#FFF0FFFF","#FFF5F5DC","#FFFFE4C4","#FF000000","#FFFFEBCD","#FF0000FF","#FF8A2BE2","#FFA52A2A","#FFDEB887","#FF5F9EA0","#FF7FFF00","#FFD2691E","#FFFF7F50","#FF6495ED","#FFFFF8DC","#FFDC143C","#FF00FFFF","#FF00008B","#FF008B8B","#FFB8860B","#FFA9A9A9","#FF006400","#FFBDB76B","#FF8B008B","#FF556B2F","#FFFF8C00","#FF9932CC","#FF8B0000","#FFE9967A","#FF8FBC8F","#FF483D8B","#FF2F4F4F","#FF00CED1","#FF9400D3","#FFFF1493","#FF00BFFF","#FF696969","#FF1E90FF","#FFB22222","#FFFFFAF0","#FF228B22","#FFFF00FF","#FFDCDCDC","#FFF8F8FF","#FFFFD700","#FFDAA520","#FF808080","#FF008000","#FFADFF2F","#FFF0FFF0","#FFFF69B4","#FFCD5C5C","#FF4B0082","#FFFFFFF0","#FFF0E68C","#FFE6E6FA","#FFFFF0F5","#FF7CFC00","#FFFFFACD","#FFADD8E6","#FFF08080","#FFE0FFFF","#FFFAFAD2","#FFD3D3D3","#FF90EE90","#FFFFB6C1","#FFFFA07A","#FF20B2AA","#FF87CEFA","#FF778899","#FFB0C4DE","#FFFFFFE0","#FF00FF00","#FF32CD32","#FFFAF0E6","#FFFF00FF","#FF800000","#FF66CDAA","#FF0000CD","#FFBA55D3","#FF9370DB","#FF3CB371","#FF7B68EE","#FF00FA9A","#FF48D1CC","#FFC71585","#FF191970","#FFF5FFFA","#FFFFE4E1","#FFFFE4B5","#FFFFDEAD","#FF000080","#FFFDF5E6","#FF808000","#FF6B8E23","#FFFFA500","#FFFF4500","#FFDA70D6","#FFEEE8AA","#FF98FB98","#FFAFEEEE","#FFDB7093","#FFFFEFD5","#FFFFDAB9","#FFCD853F","#FFFFC0CB","#FFDDA0DD","#FFB0E0E6","#FF800080","#FFFF0000","#FFBC8F8F","#FF4169E1","#FF8B4513","#FFFA8072","#FFF4A460","#FF2E8B57","#FFFFF5EE","#FFA0522D","#FFC0C0C0","#FF87CEEB","#FF6A5ACD","#FF708090","#FFFFFAFA","#FF00FF7F","#FF4682B4","#FFD2B48C","#FF008080","#FFD8BFD8","#FFFF6347","","#FF40E0D0","#FFEE82EE","#FFF5DEB3","#FFFFFFFF","#FFF5F5F5","#FFFFFF00","#FF9ACD32")
var newColor = "";
function switchColor(element, index, array) {
newColor += '#' + element.substring(3) + ',';
}
colors.forEach(switchColor);
答案 1 :(得分:0)
作为额外奖励,我还想要将每种颜色的稍暗版本用作边框。我合并了一些JS以获得我需要的东西:
略微更暗的版本:
AliceBlue#d2e1da
AntiqueWhite#dcb9cd
Aqua#00e1e1
海蓝宝石#61b6e1
Azure#d2e1e1
米色#d7bed7
Bisque#e1a6c6
黑色#000000
BlanchedAlmond#e1afcd
蓝色#00e100
BlueViolet#6cc40d
布朗#870c0c
BurlyWood#c0699a
CadetBlue#418280
Chartreuse#6100e1
巧克力#b4004b
珊瑚#e13261
CornflowerBlue#46cf77
Cornsilk#e1beda
Crimson#be1e00
青色#00e1e1
DarkBlue#006d00
DarkCyan#006d6d
DarkGoldenrod#9a0068
DarkGray#8b8b8b
DarkGreen#000046
DarkKhaki#9f4d99
DarkMagenta#6d6d00
DarkOliveGreen#37114d
DarkOrange#e1006e
DarkOrchid#7bae14
DarkRed#6d0000
DarkSalmon#cb5c78
DarkSeaGreen#71719e
DarkSlateBlue#2a6d1f
DarkSlateGray#113131
DarkTurquoise#00b3b0
DarkViolet#76b500
DeepPink#e17500
DeepSkyBlue#00e1a1
DimGray#4b4b4b
DodgerBlue#00e172
Firebrick#940404
FloralWhite#e1d2dc
ForestGreen#04046d
紫红色#e1e100
Gainsboro #bebebe
GhostWhite#dae1da
Gold#e100b9
Goldenrod#bc0287
格雷#626262
绿色#000062
GreenYellow#8f11e1
Honeydew#d2d2e1
HotPink#e1964b
IndianRed#af3e3e
Indigo#2d6400
Ivory#e1d2e1
卡其色#d26ec8薰衣草#c8dcc8
LavenderBlush#e1d7d2
LawnGreen#5e00de
LemonChiffon#e1afdc
LightBlue#8fc8ba
LightCoral#d26262
LightCyan#c2e1e1
LightGoldenrodYellow#dcb4dc
LightGray#b5b5b5
LightGreen#7272d0
LightPink#e1a398
LightSalmon#e15c82
LightSeaGreen#028c94
LightSkyBlue#69dcb0
LightSlateGray#597b6a
LightSteelBlue#92c0a6
LightYellow#e1c2e1
Lime#0000e1
LimeGreen#1414af
亚麻#dcc8d2
Magenta#e1e100
栗色#620000
MediumAquamarine#488caf
MediumBlue#00af00
MediumOrchid#9cb537
MediumPurple#75bd52
MediumSeaGreen#1e5395
MediumSlateBlue#5dd04a
MediumSpringGreen#007cdc
MediumTurquoise#2aaeb3
MediumVioletRed#a96700
MidnightBlue#005200
MintCream#d7dce1
MistyRose#e1c3c6
Moccasin#e197c6
NavajoWhite#e18fc0
海军#006200
OldLace#dfc8d7
Olive#620062
OliveDrab#4d0570
Orange#e10087
OrangeRed#e10027
Orchid#bcb852
PaleGoldenrod#d08cca
PaleGreen#7a7add
PaleTurquoise#91d0d0
PaleVioletRed#bd7552
PapayaWhip#e1b7d1
PeachPuff#e19bbc
秘鲁#af2167
Pink#e1ada2
Plum#bfbf82
PowderBlue#92c8c2
紫色#626200
红色#e10000
RosyBrown#9e7171
RoyalBlue#23c34b
SaddleBrown#6d0027
Salmon#dc5462
SandyBrown#d64286
SeaGreen#10396d
SeaShell#e1d0d7
Sienna#820f34
Silver#a2a2a2
SkyBlue#69cdb0
SlateBlue#4caf3c
SlateGray#527262
Snow#e1dcdc
SpringGreen#0061e1
SteelBlue#289664
Tan#b46e96
Teal#006262
Thistle#babaa1
番茄#e12945
透明#000000
Turquoise#22b2c2
紫罗兰#d0d064
小麦#d795c0
白色#e1e1e1
WhiteSmoke#d7d7d7
黄色#e100e1
YellowGreen#7c14af
作为CSS块,使用较暗的版本作为边框:
.AliceBlue{background-color:#F0F8FF;border:1px solid #d2e1da;}
.AntiqueWhite{background-color:#FAEBD7;border:1px solid #dcb9cd;}
.Aqua{background-color:#00FFFF;border:1px solid #00e1e1;}
.Aquamarine{background-color:#7FFFD4;border:1px solid #61b6e1;}
.Azure{background-color:#F0FFFF;border:1px solid #d2e1e1;}
.Beige{background-color:#F5F5DC;border:1px solid #d7bed7;}
.Bisque{background-color:#FFE4C4;border:1px solid #e1a6c6;}
.Black{background-color:#000000;border:1px solid #000000;}
.BlanchedAlmond{background-color:#FFEBCD;border:1px solid #e1afcd;}
.Blue{background-color:#0000FF;border:1px solid #00e100;}
.BlueViolet{background-color:#8A2BE2;border:1px solid #6cc40d;}
.Brown{background-color:#A52A2A;border:1px solid #870c0c;}
.BurlyWood{background-color:#DEB887;border:1px solid #c0699a;}
.CadetBlue{background-color:#5F9EA0;border:1px solid #418280;}
.Chartreuse{background-color:#7FFF00;border:1px solid #6100e1;}
.Chocolate{background-color:#D2691E;border:1px solid #b4004b;}
.Coral{background-color:#FF7F50;border:1px solid #e13261;}
.CornflowerBlue{background-color:#6495ED;border:1px solid #46cf77;}
.Cornsilk{background-color:#FFF8DC;border:1px solid #e1beda;}
.Crimson{background-color:#DC143C;border:1px solid #be1e00;}
.Cyan{background-color:#00FFFF;border:1px solid #00e1e1;}
.DarkBlue{background-color:#00008B;border:1px solid #006d00;}
.DarkCyan{background-color:#008B8B;border:1px solid #006d6d;}
.DarkGoldenrod{background-color:#B8860B;border:1px solid #9a0068;}
.DarkGray{background-color:#A9A9A9;border:1px solid #8b8b8b;}
.DarkGreen{background-color:#006400;border:1px solid #000046;}
.DarkKhaki{background-color:#BDB76B;border:1px solid #9f4d99;}
.DarkMagenta{background-color:#8B008B;border:1px solid #6d6d00;}
.DarkOliveGreen{background-color:#556B2F;border:1px solid #37114d;}
.DarkOrange{background-color:#FF8C00;border:1px solid #e1006e;}
.DarkOrchid{background-color:#9932CC;border:1px solid #7bae14;}
.DarkRed{background-color:#8B0000;border:1px solid #6d0000;}
.DarkSalmon{background-color:#E9967A;border:1px solid #cb5c78;}
.DarkSeaGreen{background-color:#8FBC8F;border:1px solid #71719e;}
.DarkSlateBlue{background-color:#483D8B;border:1px solid #2a6d1f;}
.DarkSlateGray{background-color:#2F4F4F;border:1px solid #113131;}
.DarkTurquoise{background-color:#00CED1;border:1px solid #00b3b0;}
.DarkViolet{background-color:#9400D3;border:1px solid #76b500;}
.DeepPink{background-color:#FF1493;border:1px solid #e17500;}
.DeepSkyBlue{background-color:#00BFFF;border:1px solid #00e1a1;}
.DimGray{background-color:#696969;border:1px solid #4b4b4b;}
.DodgerBlue{background-color:#1E90FF;border:1px solid #00e172;}
.Firebrick{background-color:#B22222;border:1px solid #940404;}
.FloralWhite{background-color:#FFFAF0;border:1px solid #e1d2dc;}
.ForestGreen{background-color:#228B22;border:1px solid #04046d;}
.Fuchsia{background-color:#FF00FF;border:1px solid #e1e100;}
.Gainsboro{background-color:#DCDCDC;border:1px solid #bebebe;}
.GhostWhite{background-color:#F8F8FF;border:1px solid #dae1da;}
.Gold{background-color:#FFD700;border:1px solid #e100b9;}
.Goldenrod{background-color:#DAA520;border:1px solid #bc0287;}
.Gray{background-color:#808080;border:1px solid #626262;}
.Green{background-color:#008000;border:1px solid #000062;}
.GreenYellow{background-color:#ADFF2F;border:1px solid #8f11e1;}
.Honeydew{background-color:#F0FFF0;border:1px solid #d2d2e1;}
.HotPink{background-color:#FF69B4;border:1px solid #e1964b;}
.IndianRed{background-color:#CD5C5C;border:1px solid #af3e3e;}
.Indigo{background-color:#4B0082;border:1px solid #2d6400;}
.Ivory{background-color:#FFFFF0;border:1px solid #e1d2e1;}
.Khaki{background-color:#F0E68C;border:1px solid #d26ec8;}
.Lavender{background-color:#E6E6FA;border:1px solid #c8dcc8;}
.LavenderBlush{background-color:#FFF0F5;border:1px solid #e1d7d2;}
.LawnGreen{background-color:#7CFC00;border:1px solid #5e00de;}
.LemonChiffon{background-color:#FFFACD;border:1px solid #e1afdc;}
.LightBlue{background-color:#ADD8E6;border:1px solid #8fc8ba;}
.LightCoral{background-color:#F08080;border:1px solid #d26262;}
.LightCyan{background-color:#E0FFFF;border:1px solid #c2e1e1;}
.LightGoldenrodYellow{background-color:#FAFAD2;border:1px solid #dcb4dc;}
.LightGray{background-color:#D3D3D3;border:1px solid #b5b5b5;}
.LightGreen{background-color:#90EE90;border:1px solid #7272d0;}
.LightPink{background-color:#FFB6C1;border:1px solid #e1a398;}
.LightSalmon{background-color:#FFA07A;border:1px solid #e15c82;}
.LightSeaGreen{background-color:#20B2AA;border:1px solid #028c94;}
.LightSkyBlue{background-color:#87CEFA;border:1px solid #69dcb0;}
.LightSlateGray{background-color:#778899;border:1px solid #597b6a;}
.LightSteelBlue{background-color:#B0C4DE;border:1px solid #92c0a6;}
.LightYellow{background-color:#FFFFE0;border:1px solid #e1c2e1;}
.Lime{background-color:#00FF00;border:1px solid #0000e1;}
.LimeGreen{background-color:#32CD32;border:1px solid #1414af;}
.Linen{background-color:#FAF0E6;border:1px solid #dcc8d2;}
.Magenta{background-color:#FF00FF;border:1px solid #e1e100;}
.Maroon{background-color:#800000;border:1px solid #620000;}
.MediumAquamarine{background-color:#66CDAA;border:1px solid #488caf;}
.MediumBlue{background-color:#0000CD;border:1px solid #00af00;}
.MediumOrchid{background-color:#BA55D3;border:1px solid #9cb537;}
.MediumPurple{background-color:#9370DB;border:1px solid #75bd52;}
.MediumSeaGreen{background-color:#3CB371;border:1px solid #1e5395;}
.MediumSlateBlue{background-color:#7B68EE;border:1px solid #5dd04a;}
.MediumSpringGreen{background-color:#00FA9A;border:1px solid #007cdc;}
.MediumTurquoise{background-color:#48D1CC;border:1px solid #2aaeb3;}
.MediumVioletRed{background-color:#C71585;border:1px solid #a96700;}
.MidnightBlue{background-color:#191970;border:1px solid #005200;}
.MintCream{background-color:#F5FFFA;border:1px solid #d7dce1;}
.MistyRose{background-color:#FFE4E1;border:1px solid #e1c3c6;}
.Moccasin{background-color:#FFE4B5;border:1px solid #e197c6;}
.NavajoWhite{background-color:#FFDEAD;border:1px solid #e18fc0;}
.Navy{background-color:#000080;border:1px solid #006200;}
.OldLace{background-color:#FDF5E6;border:1px solid #dfc8d7;}
.Olive{background-color:#808000;border:1px solid #620062;}
.OliveDrab{background-color:#6B8E23;border:1px solid #4d0570;}
.Orange{background-color:#FFA500;border:1px solid #e10087;}
.OrangeRed{background-color:#FF4500;border:1px solid #e10027;}
.Orchid{background-color:#DA70D6;border:1px solid #bcb852;}
.PaleGoldenrod{background-color:#EEE8AA;border:1px solid #d08cca;}
.PaleGreen{background-color:#98FB98;border:1px solid #7a7add;}
.PaleTurquoise{background-color:#AFEEEE;border:1px solid #91d0d0;}
.PaleVioletRed{background-color:#DB7093;border:1px solid #bd7552;}
.PapayaWhip{background-color:#FFEFD5;border:1px solid #e1b7d1;}
.PeachPuff{background-color:#FFDAB9;border:1px solid #e19bbc;}
.Peru{background-color:#CD853F;border:1px solid #af2167;}
.Pink{background-color:#FFC0CB;border:1px solid #e1ada2;}
.Plum{background-color:#DDA0DD;border:1px solid #bfbf82;}
.PowderBlue{background-color:#B0E0E6;border:1px solid #92c8c2;}
.Purple{background-color:#800080;border:1px solid #626200;}
.Red{background-color:#FF0000;border:1px solid #e10000;}
.RosyBrown{background-color:#BC8F8F;border:1px solid #9e7171;}
.RoyalBlue{background-color:#4169E1;border:1px solid #23c34b;}
.SaddleBrown{background-color:#8B4513;border:1px solid #6d0027;}
.Salmon{background-color:#FA8072;border:1px solid #dc5462;}
.SandyBrown{background-color:#F4A460;border:1px solid #d64286;}
.SeaGreen{background-color:#2E8B57;border:1px solid #10396d;}
.SeaShell{background-color:#FFF5EE;border:1px solid #e1d0d7;}
.Sienna{background-color:#A0522D;border:1px solid #820f34;}
.Silver{background-color:#C0C0C0;border:1px solid #a2a2a2;}
.SkyBlue{background-color:#87CEEB;border:1px solid #69cdb0;}
.SlateBlue{background-color:#6A5ACD;border:1px solid #4caf3c;}
.SlateGray{background-color:#708090;border:1px solid #527262;}
.Snow{background-color:#FFFAFA;border:1px solid #e1dcdc;}
.SpringGreen{background-color:#00FF7F;border:1px solid #0061e1;}
.SteelBlue{background-color:#4682B4;border:1px solid #289664;}
.Tan{background-color:#D2B48C;border:1px solid #b46e96;}
.Teal{background-color:#008080;border:1px solid #006262;}
.Thistle{background-color:#D8BFD8;border:1px solid #babaa1;}
.Tomato{background-color:#FF6347;border:1px solid #e12945;}
.Transparent{background-color:none;border:1px solid #000000;}
.Turquoise{background-color:#40E0D0;border:1px solid #22b2c2;}
.Violet{background-color:#EE82EE;border:1px solid #d0d064;}
.Wheat{background-color:#F5DEB3;border:1px solid #d795c0;}
.White{background-color:#FFFFFF;border:1px solid #e1e1e1;}
.WhiteSmoke{background-color:#F5F5F5;border:1px solid #d7d7d7;}
.Yellow{background-color:#FFFF00;border:1px solid #e100e1;}
.YellowGreen{background-color:#9ACD32;border:1px solid #7c14af;}
使颜色变暗的脚本
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fun /*, thisp*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this)
fun.call(thisp, this[i], i, this);
}
};
}
var colors;
colors = new Array;
colors.push("#FFF0F8FF","#FFFAEBD7","#FF00FFFF","#FF7FFFD4","#FFF0FFFF","#FFF5F5DC","#FFFFE4C4","#FF000000","#FFFFEBCD","#FF0000FF","#FF8A2BE2","#FFA52A2A","#FFDEB887","#FF5F9EA0","#FF7FFF00","#FFD2691E","#FFFF7F50","#FF6495ED","#FFFFF8DC","#FFDC143C","#FF00FFFF","#FF00008B","#FF008B8B","#FFB8860B","#FFA9A9A9","#FF006400","#FFBDB76B","#FF8B008B","#FF556B2F","#FFFF8C00","#FF9932CC","#FF8B0000","#FFE9967A","#FF8FBC8F","#FF483D8B","#FF2F4F4F","#FF00CED1","#FF9400D3","#FFFF1493","#FF00BFFF","#FF696969","#FF1E90FF","#FFB22222","#FFFFFAF0","#FF228B22","#FFFF00FF","#FFDCDCDC","#FFF8F8FF","#FFFFD700","#FFDAA520","#FF808080","#FF008000","#FFADFF2F","#FFF0FFF0","#FFFF69B4","#FFCD5C5C","#FF4B0082","#FFFFFFF0","#FFF0E68C","#FFE6E6FA","#FFFFF0F5","#FF7CFC00","#FFFFFACD","#FFADD8E6","#FFF08080","#FFE0FFFF","#FFFAFAD2","#FFD3D3D3","#FF90EE90","#FFFFB6C1","#FFFFA07A","#FF20B2AA","#FF87CEFA","#FF778899","#FFB0C4DE","#FFFFFFE0","#FF00FF00","#FF32CD32","#FFFAF0E6","#FFFF00FF","#FF800000","#FF66CDAA","#FF0000CD","#FFBA55D3","#FF9370DB","#FF3CB371","#FF7B68EE","#FF00FA9A","#FF48D1CC","#FFC71585","#FF191970","#FFF5FFFA","#FFFFE4E1","#FFFFE4B5","#FFFFDEAD","#FF000080","#FFFDF5E6","#FF808000","#FF6B8E23","#FFFFA500","#FFFF4500","#FFDA70D6","#FFEEE8AA","#FF98FB98","#FFAFEEEE","#FFDB7093","#FFFFEFD5","#FFFFDAB9","#FFCD853F","#FFFFC0CB","#FFDDA0DD","#FFB0E0E6","#FF800080","#FFFF0000","#FFBC8F8F","#FF4169E1","#FF8B4513","#FFFA8072","#FFF4A460","#FF2E8B57","#FFFFF5EE","#FFA0522D","#FFC0C0C0","#FF87CEEB","#FF6A5ACD","#FF708090","#FFFFFAFA","#FF00FF7F","#FF4682B4","#FFD2B48C","#FF008080","#FFD8BFD8","#FFFF6347","","#FF40E0D0","#FFEE82EE","#FFF5DEB3","#FFFFFFFF","#FFF5F5F5","#FFFFFF00","#FF9ACD32")
var newColor = "";
function switchColor(element, index, array) {
newColor += "#" + DarkenLightenColor(element.substring(3),30) + ",";
}
colors.forEach(switchColor);
newColor;
function DarkenLightenColor(col,amt) {
var usePound = false;
if ( col[0] == "#" ) {
col = col.slice(1);
usePound = true;
}
var num = parseInt(col,16);
var r = (num >> 16) - amt;
if ( r > 255 ) r = 255;
else if (r < 0) r = 0;
var b = ((num >> 8) & 0x00FF) - amt;
if ( b > 255 ) b = 255;
else if (b < 0) b = 0;
var g = (num & 0x0000FF) - amt;
if ( g > 255 ) g = 255;
else if ( g < 0 ) g = 0;
var rStr = (r.toString(16).length < 2)?'0'+r.toString(16):r.toString(16);
var gStr = (g.toString(16).length < 2)?'0'+g.toString(16):g.toString(16);
var bStr = (b.toString(16).length < 2)?'0'+b.toString(16):b.toString(16);
return (usePound?"#":"") + rStr + gStr + bStr;
}
答案 2 :(得分:0)