public virtual LibraryTheme?GenerateRuntimeLibraryTheme(string baseColor, Color accentColor, bool isHighContrast, LibraryThemeProvider libraryThemeProvider)
        {
            var themeGeneratorParametersContent = libraryThemeProvider.GetThemeGeneratorParametersContent();

            if (string.IsNullOrEmpty(themeGeneratorParametersContent))
            {
                return(null);
            }

            var themeTemplateContent = libraryThemeProvider.GetThemeTemplateContent();

            if (string.IsNullOrEmpty(themeTemplateContent))
            {
                return(null);
            }

            var generatorParameters = ThemeGenerator.Current.GetParametersFromString(themeGeneratorParametersContent !);

            var baseColorScheme = generatorParameters.BaseColorSchemes.First(x => x.Name == baseColor);

            var colorScheme = new ThemeGenerator.ThemeGeneratorColorScheme
            {
                Name = accentColor.ToString()
            };

            var themeName        = $"{baseColor}.Runtime_{colorScheme.Name}";
            var themeDisplayName = $"Runtime {colorScheme.Name} ({baseColor})";

            if (isHighContrast)
            {
                themeDisplayName += " HighContrast";
            }

            var values = colorScheme.Values;

            var runtimeThemeColorValues = this.GetColors(accentColor, this.Options.CreateRuntimeThemeOptions(isHighContrast, generatorParameters, baseColorScheme));

            return(this.GenerateRuntimeLibraryTheme(libraryThemeProvider, values, runtimeThemeColorValues, themeTemplateContent !, themeName, themeDisplayName, baseColorScheme, colorScheme, generatorParameters));
        }
        public virtual LibraryTheme GenerateRuntimeLibraryTheme(LibraryThemeProvider libraryThemeProvider, Dictionary <string, string> values, RuntimeThemeColorValues runtimeThemeColorValues, string themeTemplateContent, string themeName, string themeDisplayName, ThemeGenerator.ThemeGeneratorBaseColorScheme baseColorScheme, ThemeGenerator.ThemeGeneratorColorScheme colorScheme, ThemeGenerator.ThemeGeneratorParameters generatorParameters)
        {
            values.Add("ThemeGenerator.Colors.PrimaryAccentColor", runtimeThemeColorValues.PrimaryAccentColor.ToString());
            values.Add("ThemeGenerator.Colors.AccentBaseColor", runtimeThemeColorValues.AccentBaseColor.ToString());
            values.Add("ThemeGenerator.Colors.AccentColor80", runtimeThemeColorValues.AccentColor80.ToString());
            values.Add("ThemeGenerator.Colors.AccentColor60", runtimeThemeColorValues.AccentColor60.ToString());
            values.Add("ThemeGenerator.Colors.AccentColor40", runtimeThemeColorValues.AccentColor40.ToString());
            values.Add("ThemeGenerator.Colors.AccentColor20", runtimeThemeColorValues.AccentColor20.ToString());

            values.Add("ThemeGenerator.Colors.HighlightColor", runtimeThemeColorValues.HighlightColor.ToString());
            values.Add("ThemeGenerator.Colors.IdealForegroundColor", runtimeThemeColorValues.IdealForegroundColor.ToString());

            libraryThemeProvider.FillColorSchemeValues(values, runtimeThemeColorValues);

            var xamlContent = ThemeGenerator.Current.GenerateColorSchemeFileContent(themeTemplateContent !, themeName, themeDisplayName, baseColorScheme.Name, colorScheme.Name, colorScheme.Name, runtimeThemeColorValues.Options.IsHighContrast, colorScheme.Values, baseColorScheme.Values, generatorParameters.DefaultValues);

            var preparedXamlContent = libraryThemeProvider.PrepareXamlContent(this, xamlContent, runtimeThemeColorValues);

            var resourceDictionary = (ResourceDictionary)XamlReader.Parse(preparedXamlContent);

            resourceDictionary.Add(Theme.ThemeIsRuntimeGeneratedKey, true);
            resourceDictionary[Theme.ThemeIsHighContrastKey]            = runtimeThemeColorValues.Options.IsHighContrast;
            resourceDictionary[LibraryTheme.RuntimeThemeColorValuesKey] = runtimeThemeColorValues;

            libraryThemeProvider.PrepareRuntimeThemeResourceDictionary(this, resourceDictionary, runtimeThemeColorValues);

            var runtimeLibraryTheme = libraryThemeProvider.CreateRuntimeLibraryTheme(resourceDictionary, runtimeThemeColorValues);

            return(runtimeLibraryTheme);
        }