11// Copyright (c) Six Labors and contributors.
22// Licensed under the Apache License, Version 2.0.
33
4+ using System ;
5+ using System . Collections . Generic ;
6+
47namespace SixLabors . ImageSharp
58{
69 /// <content>
710 /// Contains static named color values.
811 /// </content>
912 public readonly partial struct Color
1013 {
14+ private static readonly Lazy < Dictionary < string , Color > > NamedColorsLookupLazy = new Lazy < Dictionary < string , Color > > ( CreateNamedColorsLookup , true ) ;
15+
1116 /// <summary>
1217 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #F0F8FF.
1318 /// </summary>
@@ -111,7 +116,7 @@ public readonly partial struct Color
111116 /// <summary>
112117 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #00FFFF.
113118 /// </summary>
114- public static readonly Color Cyan = FromRgba ( 0 , 255 , 255 , 255 ) ;
119+ public static readonly Color Cyan = Aqua ;
115120
116121 /// <summary>
117122 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #00008B.
@@ -138,6 +143,11 @@ public readonly partial struct Color
138143 /// </summary>
139144 public static readonly Color DarkGreen = FromRgba ( 0 , 100 , 0 , 255 ) ;
140145
146+ /// <summary>
147+ /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #A9A9A9.
148+ /// </summary>
149+ public static readonly Color DarkGrey = DarkGray ;
150+
141151 /// <summary>
142152 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #BDB76B.
143153 /// </summary>
@@ -188,6 +198,11 @@ public readonly partial struct Color
188198 /// </summary>
189199 public static readonly Color DarkSlateGray = FromRgba ( 47 , 79 , 79 , 255 ) ;
190200
201+ /// <summary>
202+ /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #2F4F4F.
203+ /// </summary>
204+ public static readonly Color DarkSlateGrey = DarkSlateGray ;
205+
191206 /// <summary>
192207 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #00CED1.
193208 /// </summary>
@@ -213,6 +228,11 @@ public readonly partial struct Color
213228 /// </summary>
214229 public static readonly Color DimGray = FromRgba ( 105 , 105 , 105 , 255 ) ;
215230
231+ /// <summary>
232+ /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #696969.
233+ /// </summary>
234+ public static readonly Color DimGrey = DimGray ;
235+
216236 /// <summary>
217237 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #1E90FF.
218238 /// </summary>
@@ -273,6 +293,11 @@ public readonly partial struct Color
273293 /// </summary>
274294 public static readonly Color GreenYellow = FromRgba ( 173 , 255 , 47 , 255 ) ;
275295
296+ /// <summary>
297+ /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #808080.
298+ /// </summary>
299+ public static readonly Color Grey = Gray ;
300+
276301 /// <summary>
277302 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #F0FFF0.
278303 /// </summary>
@@ -353,6 +378,11 @@ public readonly partial struct Color
353378 /// </summary>
354379 public static readonly Color LightGreen = FromRgba ( 144 , 238 , 144 , 255 ) ;
355380
381+ /// <summary>
382+ /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #D3D3D3.
383+ /// </summary>
384+ public static readonly Color LightGrey = LightGray ;
385+
356386 /// <summary>
357387 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #FFB6C1.
358388 /// </summary>
@@ -378,6 +408,11 @@ public readonly partial struct Color
378408 /// </summary>
379409 public static readonly Color LightSlateGray = FromRgba ( 119 , 136 , 153 , 255 ) ;
380410
411+ /// <summary>
412+ /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #778899.
413+ /// </summary>
414+ public static readonly Color LightSlateGrey = LightSlateGray ;
415+
381416 /// <summary>
382417 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #B0C4DE.
383418 /// </summary>
@@ -406,7 +441,7 @@ public readonly partial struct Color
406441 /// <summary>
407442 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #FF00FF.
408443 /// </summary>
409- public static readonly Color Magenta = FromRgba ( 255 , 0 , 255 , 255 ) ;
444+ public static readonly Color Magenta = Fuchsia ;
410445
411446 /// <summary>
412447 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #800000.
@@ -643,6 +678,11 @@ public readonly partial struct Color
643678 /// </summary>
644679 public static readonly Color SlateGray = FromRgba ( 112 , 128 , 144 , 255 ) ;
645680
681+ /// <summary>
682+ /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #708090.
683+ /// </summary>
684+ public static readonly Color SlateGrey = SlateGray ;
685+
646686 /// <summary>
647687 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #FFFAFA.
648688 /// </summary>
@@ -717,5 +757,161 @@ public readonly partial struct Color
717757 /// Represents a <see paramref="Color"/> matching the W3C definition that has an hex value of #9ACD32.
718758 /// </summary>
719759 public static readonly Color YellowGreen = FromRgba ( 154 , 205 , 50 , 255 ) ;
760+
761+ private static Dictionary < string , Color > CreateNamedColorsLookup ( )
762+ {
763+ return new Dictionary < string , Color > ( StringComparer . OrdinalIgnoreCase )
764+ {
765+ { nameof ( AliceBlue ) , AliceBlue } ,
766+ { nameof ( AntiqueWhite ) , AntiqueWhite } ,
767+ { nameof ( Aqua ) , Aqua } ,
768+ { nameof ( Aquamarine ) , Aquamarine } ,
769+ { nameof ( Azure ) , Azure } ,
770+ { nameof ( Beige ) , Beige } ,
771+ { nameof ( Bisque ) , Bisque } ,
772+ { nameof ( Black ) , Black } ,
773+ { nameof ( BlanchedAlmond ) , BlanchedAlmond } ,
774+ { nameof ( Blue ) , Blue } ,
775+ { nameof ( BlueViolet ) , BlueViolet } ,
776+ { nameof ( Brown ) , Brown } ,
777+ { nameof ( BurlyWood ) , BurlyWood } ,
778+ { nameof ( CadetBlue ) , CadetBlue } ,
779+ { nameof ( Chartreuse ) , Chartreuse } ,
780+ { nameof ( Chocolate ) , Chocolate } ,
781+ { nameof ( Coral ) , Coral } ,
782+ { nameof ( CornflowerBlue ) , CornflowerBlue } ,
783+ { nameof ( Cornsilk ) , Cornsilk } ,
784+ { nameof ( Crimson ) , Crimson } ,
785+ { nameof ( Cyan ) , Cyan } ,
786+ { nameof ( DarkBlue ) , DarkBlue } ,
787+ { nameof ( DarkCyan ) , DarkCyan } ,
788+ { nameof ( DarkGoldenrod ) , DarkGoldenrod } ,
789+ { nameof ( DarkGray ) , DarkGray } ,
790+ { nameof ( DarkGreen ) , DarkGreen } ,
791+ { nameof ( DarkGrey ) , DarkGrey } ,
792+ { nameof ( DarkKhaki ) , DarkKhaki } ,
793+ { nameof ( DarkMagenta ) , DarkMagenta } ,
794+ { nameof ( DarkOliveGreen ) , DarkOliveGreen } ,
795+ { nameof ( DarkOrange ) , DarkOrange } ,
796+ { nameof ( DarkOrchid ) , DarkOrchid } ,
797+ { nameof ( DarkRed ) , DarkRed } ,
798+ { nameof ( DarkSalmon ) , DarkSalmon } ,
799+ { nameof ( DarkSeaGreen ) , DarkSeaGreen } ,
800+ { nameof ( DarkSlateBlue ) , DarkSlateBlue } ,
801+ { nameof ( DarkSlateGray ) , DarkSlateGray } ,
802+ { nameof ( DarkSlateGrey ) , DarkSlateGrey } ,
803+ { nameof ( DarkTurquoise ) , DarkTurquoise } ,
804+ { nameof ( DarkViolet ) , DarkViolet } ,
805+ { nameof ( DeepPink ) , DeepPink } ,
806+ { nameof ( DeepSkyBlue ) , DeepSkyBlue } ,
807+ { nameof ( DimGray ) , DimGray } ,
808+ { nameof ( DimGrey ) , DimGrey } ,
809+ { nameof ( DodgerBlue ) , DodgerBlue } ,
810+ { nameof ( Firebrick ) , Firebrick } ,
811+ { nameof ( FloralWhite ) , FloralWhite } ,
812+ { nameof ( ForestGreen ) , ForestGreen } ,
813+ { nameof ( Fuchsia ) , Fuchsia } ,
814+ { nameof ( Gainsboro ) , Gainsboro } ,
815+ { nameof ( GhostWhite ) , GhostWhite } ,
816+ { nameof ( Gold ) , Gold } ,
817+ { nameof ( Goldenrod ) , Goldenrod } ,
818+ { nameof ( Gray ) , Gray } ,
819+ { nameof ( Green ) , Green } ,
820+ { nameof ( GreenYellow ) , GreenYellow } ,
821+ { nameof ( Grey ) , Grey } ,
822+ { nameof ( Honeydew ) , Honeydew } ,
823+ { nameof ( HotPink ) , HotPink } ,
824+ { nameof ( IndianRed ) , IndianRed } ,
825+ { nameof ( Indigo ) , Indigo } ,
826+ { nameof ( Ivory ) , Ivory } ,
827+ { nameof ( Khaki ) , Khaki } ,
828+ { nameof ( Lavender ) , Lavender } ,
829+ { nameof ( LavenderBlush ) , LavenderBlush } ,
830+ { nameof ( LawnGreen ) , LawnGreen } ,
831+ { nameof ( LemonChiffon ) , LemonChiffon } ,
832+ { nameof ( LightBlue ) , LightBlue } ,
833+ { nameof ( LightCoral ) , LightCoral } ,
834+ { nameof ( LightCyan ) , LightCyan } ,
835+ { nameof ( LightGoldenrodYellow ) , LightGoldenrodYellow } ,
836+ { nameof ( LightGray ) , LightGray } ,
837+ { nameof ( LightGreen ) , LightGreen } ,
838+ { nameof ( LightGrey ) , LightGrey } ,
839+ { nameof ( LightPink ) , LightPink } ,
840+ { nameof ( LightSalmon ) , LightSalmon } ,
841+ { nameof ( LightSeaGreen ) , LightSeaGreen } ,
842+ { nameof ( LightSkyBlue ) , LightSkyBlue } ,
843+ { nameof ( LightSlateGray ) , LightSlateGray } ,
844+ { nameof ( LightSlateGrey ) , LightSlateGrey } ,
845+ { nameof ( LightSteelBlue ) , LightSteelBlue } ,
846+ { nameof ( LightYellow ) , LightYellow } ,
847+ { nameof ( Lime ) , Lime } ,
848+ { nameof ( LimeGreen ) , LimeGreen } ,
849+ { nameof ( Linen ) , Linen } ,
850+ { nameof ( Magenta ) , Magenta } ,
851+ { nameof ( Maroon ) , Maroon } ,
852+ { nameof ( MediumAquamarine ) , MediumAquamarine } ,
853+ { nameof ( MediumBlue ) , MediumBlue } ,
854+ { nameof ( MediumOrchid ) , MediumOrchid } ,
855+ { nameof ( MediumPurple ) , MediumPurple } ,
856+ { nameof ( MediumSeaGreen ) , MediumSeaGreen } ,
857+ { nameof ( MediumSlateBlue ) , MediumSlateBlue } ,
858+ { nameof ( MediumSpringGreen ) , MediumSpringGreen } ,
859+ { nameof ( MediumTurquoise ) , MediumTurquoise } ,
860+ { nameof ( MediumVioletRed ) , MediumVioletRed } ,
861+ { nameof ( MidnightBlue ) , MidnightBlue } ,
862+ { nameof ( MintCream ) , MintCream } ,
863+ { nameof ( MistyRose ) , MistyRose } ,
864+ { nameof ( Moccasin ) , Moccasin } ,
865+ { nameof ( NavajoWhite ) , NavajoWhite } ,
866+ { nameof ( Navy ) , Navy } ,
867+ { nameof ( OldLace ) , OldLace } ,
868+ { nameof ( Olive ) , Olive } ,
869+ { nameof ( OliveDrab ) , OliveDrab } ,
870+ { nameof ( Orange ) , Orange } ,
871+ { nameof ( OrangeRed ) , OrangeRed } ,
872+ { nameof ( Orchid ) , Orchid } ,
873+ { nameof ( PaleGoldenrod ) , PaleGoldenrod } ,
874+ { nameof ( PaleGreen ) , PaleGreen } ,
875+ { nameof ( PaleTurquoise ) , PaleTurquoise } ,
876+ { nameof ( PaleVioletRed ) , PaleVioletRed } ,
877+ { nameof ( PapayaWhip ) , PapayaWhip } ,
878+ { nameof ( PeachPuff ) , PeachPuff } ,
879+ { nameof ( Peru ) , Peru } ,
880+ { nameof ( Pink ) , Pink } ,
881+ { nameof ( Plum ) , Plum } ,
882+ { nameof ( PowderBlue ) , PowderBlue } ,
883+ { nameof ( Purple ) , Purple } ,
884+ { nameof ( RebeccaPurple ) , RebeccaPurple } ,
885+ { nameof ( Red ) , Red } ,
886+ { nameof ( RosyBrown ) , RosyBrown } ,
887+ { nameof ( RoyalBlue ) , RoyalBlue } ,
888+ { nameof ( SaddleBrown ) , SaddleBrown } ,
889+ { nameof ( Salmon ) , Salmon } ,
890+ { nameof ( SandyBrown ) , SandyBrown } ,
891+ { nameof ( SeaGreen ) , SeaGreen } ,
892+ { nameof ( SeaShell ) , SeaShell } ,
893+ { nameof ( Sienna ) , Sienna } ,
894+ { nameof ( Silver ) , Silver } ,
895+ { nameof ( SkyBlue ) , SkyBlue } ,
896+ { nameof ( SlateBlue ) , SlateBlue } ,
897+ { nameof ( SlateGray ) , SlateGray } ,
898+ { nameof ( SlateGrey ) , SlateGrey } ,
899+ { nameof ( Snow ) , Snow } ,
900+ { nameof ( SpringGreen ) , SpringGreen } ,
901+ { nameof ( SteelBlue ) , SteelBlue } ,
902+ { nameof ( Tan ) , Tan } ,
903+ { nameof ( Teal ) , Teal } ,
904+ { nameof ( Thistle ) , Thistle } ,
905+ { nameof ( Tomato ) , Tomato } ,
906+ { nameof ( Transparent ) , Transparent } ,
907+ { nameof ( Turquoise ) , Turquoise } ,
908+ { nameof ( Violet ) , Violet } ,
909+ { nameof ( Wheat ) , Wheat } ,
910+ { nameof ( White ) , White } ,
911+ { nameof ( WhiteSmoke ) , WhiteSmoke } ,
912+ { nameof ( Yellow ) , Yellow } ,
913+ { nameof ( YellowGreen ) , YellowGreen }
914+ } ;
915+ }
720916 }
721917}
0 commit comments