diff --git a/src/ImageSharp/PixelFormats/NamedColors{TPixel}.cs b/src/ImageSharp/PixelFormats/NamedColors{TPixel}.cs index ccd532bc3c..6a2902f9b1 100644 --- a/src/ImageSharp/PixelFormats/NamedColors{TPixel}.cs +++ b/src/ImageSharp/PixelFormats/NamedColors{TPixel}.cs @@ -12,6 +12,11 @@ namespace SixLabors.ImageSharp.PixelFormats public static class NamedColors where TPixel : struct, IPixel { + /// + /// Thread-safe backing field for . + /// + private static readonly Lazy WebSafePaletteLazy = new Lazy(GetWebSafePalette, true); + /// /// Represents a matching the W3C definition that has an hex value of #F0F8FF. /// @@ -723,9 +728,9 @@ namespace SixLabors.ImageSharp.PixelFormats public static readonly TPixel YellowGreen = ColorBuilder.FromRGBA(154, 205, 50, 255); /// - /// Represents a matching the W3C definition of web safe colors. + /// Gets a matching the W3C definition of web safe colors. /// - public static readonly TPixel[] WebSafePalette = GetWebSafePalette(); + public static TPixel[] WebSafePalette => WebSafePaletteLazy.Value; private static TPixel[] GetWebSafePalette() {