package com.ruoyi.common.utils.color; /** * 在JAVA中常用的颜色的16进制 和 RGB的颜色 * * @author yeqLu * @date 2020年5月7日 */ public enum ColorsEnum { LIGHTPINK("浅粉色", "xFFFFB6C1", "255,182,193"), PINK("粉红","xFFFFC0CB", "255,192,203"), CRIMSON("猩红","xFFDC143C", "220,20,60"), LAVENDERBLUSH("脸红的淡紫色","xFFFFF0F5", "255,240,245"), PALEVIOLETRED("苍白的紫罗兰红色","xFFDB7093", "219,112,147"), HOTPINK("热情的粉红","xFFFF69B4", "255,105,180"), DEEPPINK("深粉色","xFFFF1493", "255,20,147"), MEDIUMVIOLETRED("适中的紫罗兰红色","xFFC71585","199,21,133"), ORCHID("兰花的紫色","xFFDA70D6", "218,112,214"), THISTLE("蓟","xFFD8BFD8", "216,191,216"), PLUM("李子","xFFDDA0DD", "221,160,221"), VIOLET("紫罗兰","xFFEE82EE", "238,130,238"), MAGENTA("洋红","xFFFF00FF", "255,0,255"), FUCHSIA("灯笼海棠(紫红色)","xFFFF00FF", "255,0,255"), DARKMAGENTA("深洋红色","xFF8B008B","139,0,139"), PURPLE("紫色","xFF800080","128,0,128"), MEDIUMORCHID("适中的兰花紫","xFFBA55D3","186,85,211"), DARKVOILET("深紫罗兰色","xFF9400D3","148,0,211"), DARKORCHID("深兰花紫","xFF9932CC","153,50,204"), INDIGO("靛青","xFF4B0082","75,0,130"), BLUEVIOLET("深紫罗兰的蓝色","xFF8A2BE2","138,43,226"), MEDIUMPURPLE("适中的紫色","xFF9370DB","147,112,219"), MEDIUMSLATEBLUE("适中的板岩暗蓝灰色","xFF7B68EE","123,104,238"), SLATEBLUE("板岩暗蓝灰色","xFF6A5ACD","106,90,205"), DARKSLATEBLUE("深岩暗蓝灰色","xFF483D8B","72,61,139"), LAVENDER("薰衣草花的淡紫色","xFFE6E6FA", "230,230,250"), GHOSTWHITE("幽灵的白色","xFFF8F8FF", "248,248,255"), BLUE("纯蓝","xFF0000FF","0,0,255"), MEDIUMBLUE("适中的蓝色","xFF0000CD","0,0,205"), MIDNIGHTBLUE("午夜的蓝色","xFF191970", "25,25,112"), DARKBLUE("深蓝色","xFF00008B","0,0,139"), NAVY("海军蓝","xFF000080","0,0,128"), ROYALBLUE("皇军蓝","xFF4169E1","65,105,225"), CORNFLOWERBLUE("矢车菊的蓝色","xFF6495ED","100,149,237"), LIGHTSTEELBLUE("淡钢蓝","xFFB0C4DE","176,196,222"), LIGHTSLATEGRAY("浅石板灰","xFF778899","119,136,153"), SLATEGRAY("石板灰","xFF708090","112,128,144"), DODERBLUE("道奇蓝","xFF1E90FF","30,144,255"), ALICEBLUE("爱丽丝蓝","xFFF0F8FF", "240,248,255"), STEELBLUE("钢蓝","xFF4682B4","70,130,180"), LIGHTSKYBLUE("淡蓝色","xFF87CEFA","135,206,250"), SKYBLUE("天蓝色","xFF87CEEB","135,206,235"), DEEPSKYBLUE("深天蓝","xFF00BFFF","0,191,255"), LIGHTBLUE("淡蓝","xFFADD8E6","173,216,230"), POWDERBLUE("火药蓝","xFFB0E0E6","176,224,230"), CADETBLUE("军校蓝","xFF5F9EA0","95,158,160"), AZURE("蔚蓝色","xFFF0FFFF", "240,255,255"), LIGHTCYAN("淡青色","xFFE1FFFF", "225,255,255"), PALETURQUOISE("苍白的绿宝石","xFFAFEEEE","175,238,238"), CYAN("青色","xFF00FFFF","0,255,255"), AQUA("水绿色","xFF00FFFF","0,255,255"), DARKTURQUOISE("深绿宝石","xFF00CED1","0,206,209"), DARKSLATEGRAY("深石板灰","xFF2F4F4F","47,79,79"), DARKCYAN("深青色","xFF008B8B","0,139,139"), TEAL("水鸭色","xFF008080","0,128,128"), MEDIUMTURQUOISE("适中的绿宝石","xFF48D1CC","72,209,204"), LIGHTSEAGREEN("浅海洋绿","xFF20B2AA","32,178,170"), TURQUOISE("绿宝石","xFF40E0D0","64,224,208"), AUQAMARIN("绿玉碧绿色","xFF7FFFAA","127,255,170"), MEDIUMAQUAMARINE("适中的碧绿色","xFF00FA9A","0,250,154"), MEDIUMSPRINGGREEN("适中的春天的绿色","xFFF5FFFA", "245,255,250"), MINTCREAM("薄荷奶油","xFF00FF7F","0,255,127"), SPRINGGREEN("春天的绿色","xFF3CB371","60,179,113"), SEAGREEN("海洋绿","xFF2E8B57","46,139,87"), HONEYDEW("蜂蜜","xFFF0FFF0", "240,255,240"), LIGHTGREEN("淡绿色","xFF90EE90","144,238,144"), PALEGREEN("苍白的绿色","xFF98FB98","152,251,152"), DARKSEAGREEN("深海洋绿","xFF8FBC8F","143,188,143"), LIMEGREEN("酸橙绿","xFF32CD32","50,205,50"), LIME("酸橙色","xFF00FF00","0,255,0"), FORESTGREEN("森林绿","xFF228B22","34,139,34"), GREEN("纯绿","xFF008000","0,128,0"), DARKGREEN("深绿色","xFF006400","0,100,0"), CHARTREUSE("查特酒绿","xFF7FFF00","127,255,0"), LAWNGREEN("草坪绿","xFF7CFC00","124,252,0"), GREENYELLOW("绿黄色","xFFADFF2F","173,255,47"), OLIVEDRAB("橄榄土褐色","xFF556B2F","85,107,47"), BEIGE("米色(浅褐色)","xFF6B8E23","107,142,35"), LIGHTGOLDENRODYELLOW("浅秋麒麟黄","xFFFAFAD2", "250,250,210"), IVORY("象牙","xFFFFFFF0", "255,255,240"), LIGHTYELLOW("浅黄色","xFFFFFFE0", "255,255,224"), YELLOW("纯黄","xFFFFFF00", "255,255,0"), OLIVE("橄榄","xFF808000","128,128,0"), DARKKHAKI("深卡其布","xFFBDB76B","189,183,107"), LEMONCHIFFON("柠檬薄纱","xFFFFFACD", "255,250,205"), PALEGODENROD("灰秋麒麟","xFFEEE8AA", "238,232,170"), KHAKI("卡其布","xFFF0E68C", "240,230,140"), GOLD("金","xFFFFD700", "255,215,0"), CORNISLK("玉米色","xFFFFF8DC", "255,248,220"), GOLDENROD("秋麒麟","xFFDAA520", "218,165,32"), FLORALWHITE("花的白色","xFFFFFAF0", "255,250,240"), OLDLACE("老饰带","xFFFDF5E6", "253,245,230"), WHEAT("小麦色","xFFF5DEB3", "245,222,179"), MOCCASIN("鹿皮鞋","xFFFFE4B5", "255,228,181"), ORANGE("橙色","xFFFFA500", "255,165,0"), PAPAYAWHIP("番木瓜","xFFFFEFD5", "255,239,213"), BLANCHEDALMOND("漂白的杏仁","xFFFFEBCD", "255,235,205"), NAVAJOWHITE("NAVAJO白","xFFFFDEAD", "255,222,173"), ANTIQUEWHITE("古代的白色","xFFFAEBD7", "250,235,215"), TAN("晒黑","xFFD2B48C", "210,180,140"), BRULYWOOD("结实的树","xFFDEB887", "222,184,135"), BISQUE("(浓汤)乳脂,番茄等","xFFFFE4C4", "255,228,196"), DARKORANGE("深橙色","xFFFF8C00", "255,140,0"), LINEN("亚麻布","xFFFAF0E6", "250,240,230"), PERU("秘鲁","xFFCD853F", "205,133,63"), PEACHPUFF("桃色","xFFFFDAB9", "255,218,185"), SANDYBROWN("沙棕色","xFFF4A460", "244,164,96"), CHOCOLATE("巧克力","xFFD2691E", "210,105,30"), SADDLEBROWN("马鞍棕色","xFF8B4513","139,69,19"), SEASHELL("海贝壳","xFFFFF5EE", "255,245,238"), SIENNA("黄土赭色","xFFA0522D","160,82,45"), LIGHTSALMON("浅鲜肉(鲑鱼)色","xFFFFA07A", "255,160,122"), CORAL("珊瑚","xFFFF7F50", "255,127,80"), ORANGERED("橙红色","xFFFF4500", "255,69,0"), DARKSALMON("深鲜肉(鲑鱼)色","xFFE9967A", "233,150,122"), TOMATO("番茄","xFFFF6347", "255,99,71"), MISTYROSE("薄雾玫瑰","xFFFFE4E1", "255,228,225"), SALMON("鲜肉(鲑鱼)色","xFFFA8072", "250,128,114"), SNOW("雪","xFFFFFAFA", "255,250,250"), LIGHTCORAL("淡珊瑚色","xFFF08080", "240,128,128"), ROSYBROWN("玫瑰棕色","xFFBC8F8F","188,143,143"), INDIANRED("印度红","xFFCD5C5C", "205,92,92"), RED("纯红","xFFFF0000", "255,0,0"), BROWN("棕色","xFFA52A2A","165,42,42"), FIREBRICK("耐火砖","xFFB22222","178,34,34"), DARKRED("深红色","xFF8B0000","139,0,0"), MAROON("栗色","xFF800000","128,0,0"), WHITE("纯白","xFFFFFFFF", "255,255,255"), WHITESMOKE("白烟","xFFF5F5F5", "245,245,245"), GAINSBORO("GAINSBORO","xFFDCDCDC", "220,220,220"), LIGHTGREY("浅灰色","xFFD3D3D3","211,211,211"), SILVER("银白色","xFFC0C0C0","192,192,192"), DARKGRAY("深灰色","xFFA9A9A9","169,169,169"), GRAY("灰色","xFF808080","128,128,128"), DIMGRAY("暗淡的灰色","xFF696969","105,105,105"), BLACK("纯黑","xFF000000","0,0,0"); private String coment; private String hex; private String rgb; /** * @param coment 形像颜色 * @param hex HEX格式(16进治) * @param rgb GBb格式 */ private ColorsEnum(String coment, String hex, String rgb) { this.coment = coment; this.hex = hex; this.rgb = rgb; } public String getComent() { return coment; } public void setComent(String coment) { this.coment = coment; } public String getHex() { return hex; } public void setHex(String hex) { this.hex = hex; } public String getRgb() { return rgb; } public void setRgb(String rgb) { this.rgb = rgb; } }
引用
String demo = "[Sky Blue,Gray,Pink,Red,White,Yellow,Yellowsss]"; String demosub = demo.substring(1,demo.length()-1); String demoArray[] = demosub.split(","); ListdemoList = Arrays.asList(demoArray); for (String str:demoList) { /// System.out.println(str.toUpperCase().replaceAll(" ", "")); //颜色字符串转大写去空格 String upperCaseColor =str.toUpperCase().replaceAll(" ", ""); for (ColorsEnum e : ColorsEnum.values()) { if(e.name().equals(upperCaseColor)){ System.out.println( "=======比对颜色===="); System.out.println( e.name()); System.out.println(e.getComent()); } //System.out.println( e.name()); } }