Beispiel #1
0
        public void ApplyPreset(ThemePreset preset)
        {
            if (preset == null)
            {
                ActivePreset = null;
                return;
            }

            _lightRegion.BaseColor.ActiveColor    = preset.LightRegionColor;
            _darkRegion.BaseColor.ActiveColor     = preset.DarkRegionColor;
            _lightBase.BaseColor.ActiveColor      = preset.LightBaseColor;
            _darkBase.BaseColor.ActiveColor       = preset.DarkBaseColor;
            _lightPrimary.BaseColor.ActiveColor   = preset.LightPrimaryColor;
            _darkPrimary.BaseColor.ActiveColor    = preset.DarkPrimaryColor;
            _lightHyperlink.BaseColor.ActiveColor = preset.LightHyperlinkColor;
            _darkHyperlink.BaseColor.ActiveColor  = preset.DarkHyperlinkColor;

            ApplyPresetOverrides(_lightRegion.Palette, preset.LightRegionOverrides, preset.LightRegionAcrylicOverrides);
            ApplyPresetOverrides(_darkRegion.Palette, preset.DarkRegionOverrides, preset.DarkRegionAcrylicOverrides);
            ApplyPresetOverrides(_lightBase.Palette, preset.LightBaseOverrides);
            ApplyPresetOverrides(_darkBase.Palette, preset.DarkBaseOverrides);
            ApplyPresetOverrides(_lightPrimary.Palette, preset.LightPrimaryOverrides);
            ApplyPresetOverrides(_darkPrimary.Palette, preset.DarkPrimaryOverrides);
            ApplyPresetOverrides(_lightHyperlink.Palette, preset.LightHyperlinkOverrides);
            ApplyPresetOverrides(_darkHyperlink.Palette, preset.DarkHyperlinkOverrides);
        }
        public static JsonObject Serialize(ThemePreset preset)
        {
            JsonObject data = new JsonObject();

            if (!string.IsNullOrEmpty(preset.Id))
            {
                data["Id"] = JsonValue.CreateStringValue(preset.Id);
            }
            if (!string.IsNullOrEmpty(preset.Name))
            {
                data["Name"] = JsonValue.CreateStringValue(preset.Name);
            }

            void SerializeBlock(Color color, string colorNodeName, Dictionary <int, Color> overrides = null, string overridesNodeName = null, Dictionary <int, (bool, double, double?)> acrylicOverrides = null, string acrylicOverridesNodeName = null)
            {
                data[colorNodeName] = JsonValue.CreateStringValue(color.ToString());

                if (overrides != null && !string.IsNullOrEmpty(overridesNodeName))
                {
                    var overridesNode = new JsonArray();
                    foreach (int index in overrides.Keys)
                    {
                        JsonObject node = new JsonObject();
                        node["Index"] = JsonValue.CreateNumberValue(index);
                        node["Color"] = JsonValue.CreateStringValue(overrides[index].ToString());
                        overridesNode.Add(node);
                    }
                    data[overridesNodeName] = overridesNode;
                }

                if (acrylicOverrides != null && !string.IsNullOrEmpty(acrylicOverridesNodeName))
                {
                    var acrylicOverridesNode = new JsonArray();
                    foreach ((int index, (bool isHostBackdrop, double tintOpacity, double?tintLuminosityOpacity)) in acrylicOverrides)
                    {
                        JsonObject node = new JsonObject();
                        node["Index"]          = JsonValue.CreateNumberValue(index);
                        node["TintOpacity"]    = JsonValue.CreateNumberValue(tintOpacity);
                        node["IsHostBackdrop"] = JsonValue.CreateBooleanValue(isHostBackdrop);

                        var tintLuminosityOpacityString = (tintLuminosityOpacity == null) ? "null": tintLuminosityOpacity.ToString();
                        node["TintLuminosityOpacity"] = JsonValue.CreateStringValue(tintLuminosityOpacityString);

                        acrylicOverridesNode.Add(node);
                    }
                    data[acrylicOverridesNodeName] = acrylicOverridesNode;
                }
            }

            SerializeBlock(preset.LightRegionColor, nameof(LightRegionColor), preset.LightRegionOverrides, nameof(LightRegionOverrides), preset.LightRegionAcrylicOverrides, nameof(LightRegionAcrylicOverrides));
            SerializeBlock(preset.DarkRegionColor, nameof(DarkRegionColor), preset.DarkRegionOverrides, nameof(DarkRegionOverrides), preset.DarkRegionAcrylicOverrides, nameof(DarkRegionAcrylicOverrides));
            SerializeBlock(preset.LightBaseColor, nameof(LightBaseColor), preset.LightBaseOverrides, nameof(LightBaseOverrides));
            SerializeBlock(preset.DarkBaseColor, nameof(DarkBaseColor), preset.DarkBaseOverrides, nameof(DarkBaseOverrides));
            SerializeBlock(preset.LightPrimaryColor, nameof(LightPrimaryColor), preset.LightPrimaryOverrides, nameof(LightPrimaryOverrides));
            SerializeBlock(preset.DarkPrimaryColor, nameof(DarkPrimaryColor), preset.DarkPrimaryOverrides, nameof(DarkPrimaryOverrides));
            SerializeBlock(preset.LightHyperlinkColor, nameof(LightHyperlinkColor), preset.LightHyperlinkOverrides, nameof(LightHyperlinkOverrides));
            SerializeBlock(preset.DarkHyperlinkColor, nameof(DarkHyperlinkColor), preset.DarkHyperlinkOverrides, nameof(DarkHyperlinkOverrides));

            return(data);
        }
Beispiel #3
0
        public void AddOrReplacePreset(ThemePreset preset)
        {
            if (!string.IsNullOrEmpty(preset.Name))
            {
                var oldPreset = _presets.FirstOrDefault <ThemePreset>((a) => a.Id == preset.Id);
                if (oldPreset != null)
                {
                    _presets.Remove(oldPreset);
                }
            }

            _presets.Add(preset);

            UpdateActivePreset();
        }
Beispiel #4
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),
                },
            });
        }