public override void PrepareRuntimeThemeResourceDictionary(RuntimeThemeGenerator runtimeThemeGenerator, ResourceDictionary resourceDictionary, RuntimeThemeColorValues runtimeThemeColorValues)
        {
            base.PrepareRuntimeThemeResourceDictionary(runtimeThemeGenerator, resourceDictionary, runtimeThemeColorValues);

            resourceDictionary[Theme.ThemeOriginKey] = (string)resourceDictionary[Theme.ThemeOriginKey] + " Second";
        }
Esempio n. 2
0
 /// <inheritdoc />
 public override void FillColorSchemeValues(Dictionary <string, string> values, RuntimeThemeColorValues colorValues)
 {
 }
        public override void FillColorSchemeValues(Dictionary <string, string> values, RuntimeThemeColorValues colorValues)
        {
            values.Add("ControlzEx.Colors.AccentBaseColor", colorValues.AccentBaseColor.ToString());
            values.Add("ControlzEx.Colors.AccentColor80", colorValues.AccentColor80.ToString());
            values.Add("ControlzEx.Colors.AccentColor60", colorValues.AccentColor60.ToString());
            values.Add("ControlzEx.Colors.AccentColor40", colorValues.AccentColor40.ToString());
            values.Add("ControlzEx.Colors.AccentColor20", colorValues.AccentColor20.ToString());

            values.Add("ControlzEx.Colors.HighlightColor", colorValues.HighlightColor.ToString());
            values.Add("ControlzEx.Colors.IdealForegroundColor", colorValues.IdealForegroundColor.ToString());
        }
        public override void FillColorSchemeValues(Dictionary <string, string> values, RuntimeThemeColorValues colorValues)
        {
            values.Add("MahApps.Colors.AccentBase", colorValues.AccentBaseColor.ToString());
            values.Add("MahApps.Colors.Accent", colorValues.AccentColor80.ToString());
            values.Add("MahApps.Colors.Accent2", colorValues.AccentColor60.ToString());
            values.Add("MahApps.Colors.Accent3", colorValues.AccentColor40.ToString());
            values.Add("MahApps.Colors.Accent4", colorValues.AccentColor20.ToString());

            values.Add("MahApps.Colors.Highlight", colorValues.HighlightColor.ToString());
            values.Add("MahApps.Colors.IdealForeground", colorValues.IdealForegroundColor.ToString());
        }
Esempio n. 5
0
        public override void FillColorSchemeValues(Dictionary <string, string> values, RuntimeThemeColorValues colorValues)
        {
            // Orc / Orchestra colors
            values.Add("Orc.Colors.AccentBaseColor", colorValues.AccentBaseColor.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.AccentColor", colorValues.AccentBaseColor.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.AccentColor1", colorValues.AccentColor80.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.AccentColor2", colorValues.AccentColor60.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.AccentColor3", colorValues.AccentColor40.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.AccentColor4", colorValues.AccentColor20.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.AccentColor5", colorValues.AccentColor20.ToString(CultureInfo.InvariantCulture));

            values.Add("Orc.Colors.AccentColor80", colorValues.AccentColor80.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.AccentColor60", colorValues.AccentColor60.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.AccentColor40", colorValues.AccentColor40.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.AccentColor20", colorValues.AccentColor20.ToString(CultureInfo.InvariantCulture));

            values.Add("Orc.Colors.HighlightColor", colorValues.HighlightColor.ToString(CultureInfo.InvariantCulture));
            values.Add("Orc.Colors.IdealForegroundColor", colorValues.IdealForegroundColor.ToString(CultureInfo.InvariantCulture));

            // ControlzEx colors
            values.Add("ControlzEx.Colors.AccentBaseColor", colorValues.AccentBaseColor.ToString(CultureInfo.InvariantCulture));
            values.Add("ControlzEx.Colors.AccentColor80", colorValues.AccentColor80.ToString(CultureInfo.InvariantCulture));
            values.Add("ControlzEx.Colors.AccentColor60", colorValues.AccentColor60.ToString(CultureInfo.InvariantCulture));
            values.Add("ControlzEx.Colors.AccentColor40", colorValues.AccentColor40.ToString(CultureInfo.InvariantCulture));
            values.Add("ControlzEx.Colors.AccentColor20", colorValues.AccentColor20.ToString(CultureInfo.InvariantCulture));

            values.Add("ControlzEx.Colors.HighlightColor", colorValues.HighlightColor.ToString(CultureInfo.InvariantCulture));
            values.Add("ControlzEx.Colors.IdealForegroundColor", colorValues.IdealForegroundColor.ToString(CultureInfo.InvariantCulture));
        }
        public override void FillColorSchemeValues(Dictionary <string, string> values, RuntimeThemeColorValues colorValues)
        {
            if (values is null)
            {
                throw new ArgumentNullException(nameof(values));
            }
            if (colorValues is null)
            {
                throw new ArgumentNullException(nameof(colorValues));
            }

            if (colorValues.Options.UseHSL)
            {
                Color  background = (Color)ColorConverter.ConvertFromString(colorValues.Options.BaseColorScheme.Values["MahApps.Colors.ThemeBackground"]);
                Color  foreground = (Color)ColorConverter.ConvertFromString(colorValues.Options.BaseColorScheme.Values["MahApps.Colors.ThemeForeground"]);
                Color  accent     = colorValues.AccentBaseColor;
                double factor     = colorValues.Options.BaseColorScheme.Name == "Dark" ? 0.1 : 0.2;

                var accentHsv     = new HSVColor(accent);
                var backgroundHsv = new HSVColor(background);
                var foregroundHsv = new HSVColor(foreground);

                values.Add("MahApps.Colors.AccentBase", accent.ToString(CultureInfo.InvariantCulture));
                values.Add("MahApps.Colors.Accent", GetAccentedColor(accentHsv, backgroundHsv, factor * 1).ToString(CultureInfo.InvariantCulture));
                values.Add("MahApps.Colors.Accent2", GetAccentedColor(accentHsv, backgroundHsv, factor * 2).ToString(CultureInfo.InvariantCulture));
                values.Add("MahApps.Colors.Accent3", GetAccentedColor(accentHsv, backgroundHsv, factor * 3).ToString(CultureInfo.InvariantCulture));
                values.Add("MahApps.Colors.Accent4", GetAccentedColor(accentHsv, backgroundHsv, factor * 4).ToString(CultureInfo.InvariantCulture));

                values.Add("MahApps.Colors.Highlight", GetAccentedColor(accentHsv, foregroundHsv, factor).ToString(CultureInfo.InvariantCulture));
                values.Add("MahApps.Colors.IdealForeground", colorValues.IdealForegroundColor.ToString(CultureInfo.InvariantCulture));
            }
            else
            {
                values.Add("MahApps.Colors.AccentBase", colorValues.AccentBaseColor.ToString());
                values.Add("MahApps.Colors.Accent", colorValues.AccentColor80.ToString());
                values.Add("MahApps.Colors.Accent2", colorValues.AccentColor60.ToString());
                values.Add("MahApps.Colors.Accent3", colorValues.AccentColor40.ToString());
                values.Add("MahApps.Colors.Accent4", colorValues.AccentColor20.ToString());

                values.Add("MahApps.Colors.Highlight", colorValues.HighlightColor.ToString());
                values.Add("MahApps.Colors.IdealForeground", colorValues.IdealForegroundColor.ToString());
            }
        }
Esempio n. 7
0
        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);
        }
        public override void FillColorSchemeValues(Dictionary <string, string> values, RuntimeThemeColorValues colorValues)
        {
            // Orc / Orchestra colors
            values.Add("Orc.Colors.AccentBaseColor", colorValues.AccentBaseColor.ToString());

            // Custom theming if required, see Orc.Theming for more details
        }