示例#1
0
        public async Task InitializeData(IStringProvider stringProvider, string dataPath)
        {
            _stringProvider = stringProvider;

            StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(dataPath));

            string dataString = await FileIO.ReadTextAsync(file);

            JsonObject rootObject = JsonObject.Parse(dataString);

            _whiteColor = new ColorPaletteEntry(Colors.White, _stringProvider.GetString("DarkThemeTextContrastTitle"), null, FluentEditorShared.Utils.ColorStringFormat.PoundRGB, null);
            _blackColor = new ColorPaletteEntry(Colors.Black, _stringProvider.GetString("LightThemeTextContrastTitle"), null, FluentEditorShared.Utils.ColorStringFormat.PoundRGB, null);

            var lightRegionNode = rootObject[nameof(LightRegion)].GetObject();

            _lightRegion = ThemeColorPalette.Parse(lightRegionNode, null);

            var darkRegionNode = rootObject[nameof(DarkRegion)].GetObject();

            _darkRegion = ThemeColorPalette.Parse(darkRegionNode, null);

            var lightBaseNode = rootObject[nameof(LightBase)].GetObject();

            _lightBase = ThemeColorPalette.Parse(lightBaseNode, null);

            var darkBaseNode = rootObject[nameof(DarkBase)].GetObject();

            _darkBase = ThemeColorPalette.Parse(darkBaseNode, null);

            var lightPrimaryNode = rootObject[nameof(LightPrimary)].GetObject();

            _lightPrimary = ThemeColorPalette.Parse(lightPrimaryNode, null);

            var darkPrimaryNode = rootObject[nameof(DarkPrimary)].GetObject();

            _darkPrimary = ThemeColorPalette.Parse(darkPrimaryNode, null);

            var lightHyperlinkNode = rootObject[nameof(LightHyperlink)].GetObject();

            _lightHyperlink = ThemeColorPalette.Parse(lightHyperlinkNode, null);

            var darkHyperlinkNode = rootObject[nameof(DarkHyperlink)].GetObject();

            _darkHyperlink = ThemeColorPalette.Parse(darkHyperlinkNode, null);

            _presets = new ObservableList <ThemePreset>();
            if (rootObject.ContainsKey("Presets"))
            {
                var presetsNode = rootObject["Presets"].GetArray();
                foreach (var presetNode in presetsNode)
                {
                    _presets.Add(ThemePreset.Parse(presetNode.GetObject()));
                }
            }
            if (_presets.Count >= 1)
            {
                ApplyPreset(_presets[0]);
            }

            UpdateActivePreset();

            _lightColorMappings = ThemeColorMapping.ParseList(rootObject["LightPaletteMapping"].GetArray(), _lightRegion, _darkRegion, _lightBase, _darkBase, _lightPrimary, _darkPrimary, _lightHyperlink, _darkHyperlink, _whiteColor, _blackColor);
            _lightColorMappings.Sort((a, b) =>
            {
                return(a.Target.ToString().CompareTo(b.Target.ToString()));
            });

            _darkColorMappings = ThemeColorMapping.ParseList(rootObject["DarkPaletteMapping"].GetArray(), _lightRegion, _darkRegion, _lightBase, _darkBase, _lightPrimary, _darkPrimary, _lightHyperlink, _darkHyperlink, _whiteColor, _blackColor);
            _darkColorMappings.Sort((a, b) =>
            {
                return(a.Target.ToString().CompareTo(b.Target.ToString()));
            });

            void InitColorPalette(ColorPalette colorPalette,
                                  List <ThemeColorMapping> mappings,
                                  IReadOnlyList <ContrastColorWrapper> contrastColors,
                                  IReadOnlyList <IReadOnlyList <ContrastColorWrapper> > editContrastColors = null
                                  )
            {
                colorPalette.ContrastColors = contrastColors;

                if (editContrastColors != null)
                {
                    var idx = 0;
                    foreach (var entry in colorPalette.Palette)
                    {
                        if (idx < editContrastColors.Count && editContrastColors[idx] != null)
                        {
                            entry.ContrastColors = editContrastColors[idx];
                        }
                        ++idx;
                    }
                }

                colorPalette.BaseColor.ActiveColorChanged += PaletteEntry_ActiveColorChanged;

                foreach (var entry in colorPalette.Palette)
                {
                    entry.ActiveColorChanged += PaletteEntry_ActiveColorChanged;
                }

                foreach (var entry in colorPalette.Palette)
                {
                    if (entry.Description == null)
                    {
                        entry.Description = GenerateMappingDescription(entry, mappings);
                    }
                }
            }

            InitColorPalette(_lightRegion,
                             _lightColorMappings,
                             new List <ContrastColorWrapper>()
            {
                new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightBase.BaseColor, true, false), new ContrastColorWrapper(_lightPrimary.BaseColor, true, false), new ContrastColorWrapper(_lightHyperlink.BaseColor, true, false)
            },
                             new List <IReadOnlyList <ContrastColorWrapper> >()
            {
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, true, false), new ContrastColorWrapper(_blackColor, true, false),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.BaseColor, true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, false, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.BaseColor, true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, false, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.BaseColor, true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, false, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.BaseColor, true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, false, _lightRegion.BaseColor),
                },
            });

            InitColorPalette(_darkRegion,
                             _darkColorMappings,
                             new List <ContrastColorWrapper>()
            {
                new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkBase.BaseColor, true, false), new ContrastColorWrapper(_darkPrimary.BaseColor, true, false), new ContrastColorWrapper(_darkHyperlink.BaseColor, true, false)
            },
                             new List <IReadOnlyList <ContrastColorWrapper> >()
            {
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, true, false), new ContrastColorWrapper(_blackColor, true, false),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.BaseColor, true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, false, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.BaseColor, true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, false, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.BaseColor, true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, false, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.BaseColor, true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, false, _darkRegion.BaseColor),
                },
            });

            InitColorPalette(_lightBase,
                             _lightColorMappings,
                             new List <ContrastColorWrapper>()
            {
                new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.BaseColor, true, false),
            },
                             new List <IReadOnlyList <ContrastColorWrapper> >()
            {
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightPrimary.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightPrimary.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightPrimary.Palette[6], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, false, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, false, _lightRegion.BaseColor),
                },
            });

            InitColorPalette(_darkBase,
                             _darkColorMappings,
                             new List <ContrastColorWrapper>()
            {
                new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.BaseColor, true, false),
            },
                             new List <IReadOnlyList <ContrastColorWrapper> >()
            {
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkPrimary.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkPrimary.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkPrimary.Palette[6], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, false, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, false, _darkRegion.BaseColor),
                },
            });

            InitColorPalette(_lightPrimary,
                             _lightColorMappings,
                             new List <ContrastColorWrapper>()
            {
                new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.BaseColor, true, false),
            },
                             new List <IReadOnlyList <ContrastColorWrapper> >()
            {
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
            });

            InitColorPalette(_darkPrimary,
                             _darkColorMappings,
                             new List <ContrastColorWrapper>()
            {
                new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.BaseColor, true, false),
            },
                             new List <IReadOnlyList <ContrastColorWrapper> >()
            {
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
            });

            InitColorPalette(_lightHyperlink,
                             _lightColorMappings,
                             new List <ContrastColorWrapper>()
            {
                new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.BaseColor, true, false),
            },
                             new List <IReadOnlyList <ContrastColorWrapper> >()
            {
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion.Palette[0], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[1], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[2], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[3], true, true, _lightRegion.BaseColor), new ContrastColorWrapper(_lightRegion.Palette[4], true, true, _lightRegion.BaseColor),
                },
            });

            InitColorPalette(_darkHyperlink,
                             _darkColorMappings,
                             new List <ContrastColorWrapper>()
            {
                new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.BaseColor, true, false),
            },
                             new List <IReadOnlyList <ContrastColorWrapper> >()
            {
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
                new List <ContrastColorWrapper>()
                {
                    new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion.Palette[0], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[1], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[2], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[3], true, true, _darkRegion.BaseColor), new ContrastColorWrapper(_darkRegion.Palette[4], true, true, _darkRegion.BaseColor),
                },
            });
        }