Esempio n. 1
0
        private VisualTheme BuildTheme(string themeId, string nameResKey, bool lightTheme, Color accentColor)
        {
            AcrylicBrush backgroundAcrylic = new AcrylicBrush
            {
                BackgroundSource = AcrylicBackgroundSource.HostBackdrop,
                FallbackColor    = accentColor,
                TintColor        = accentColor,
                TintOpacity      = _setting.BackgroundTintOpacity,
            };
            AcrylicBrush backgroundAcrylic2 = new AcrylicBrush
            {
                BackgroundSource = AcrylicBackgroundSource.HostBackdrop,
                FallbackColor    = accentColor,
                TintColor        = accentColor,
                TintOpacity      = (_setting.BackgroundTintOpacity + .15) > 1 ? 1 : _setting.BackgroundTintOpacity + .15
            };
            AcrylicBrush inAppAcrylic = new AcrylicBrush
            {
                BackgroundSource = AcrylicBackgroundSource.Backdrop,
                FallbackColor    = accentColor,
                TintColor        = accentColor,
                TintOpacity      = (_setting.BackgroundTintOpacity + .05) > 1 ? 1 : _setting.BackgroundTintOpacity + .05
            };
            var    etheme            = (lightTheme) ? ElementTheme.Light : ElementTheme.Dark;
            string descriptionResKey = (lightTheme) ? "ThemeGeneralLightDescription" : "ThemeGeneralDarkDescription";
            var    theme             = new VisualTheme
            {
                ThemeId                 = themeId,
                FriendlyName            = _loader.GetString(nameResKey),
                Description             = _loader.GetString(descriptionResKey),
                Theme                   = etheme,
                BackgroundAcrylicBrush  = backgroundAcrylic,
                BackgroundAcrylicBrush2 = backgroundAcrylic2,
                InAppAcrylicBrush       = inAppAcrylic,
                SolidBackgroundBrush    = new SolidColorBrush(accentColor),
                PreviewBrush            = new SolidColorBrush(accentColor),
            };

            theme.BaseThemeBackgroundBrush    = etheme == ElementTheme.Dark ? new SolidColorBrush(Color.FromArgb(255, 28, 28, 28)) : new SolidColorBrush(Colors.White);
            _setting.afterTintOpacityChanged += theme.UpdateTintOpacity;
            return(theme);
        }
Esempio n. 2
0
 public ThemeChangedEventArgs(VisualTheme theme, VisualTheme actualTheme)
 {
     VisualTheme = theme;
     ActualTheme = actualTheme;
 }
Esempio n. 3
0
        private void Fill()
        {
            /*Priority Themes*/
            //Default:
            var defPreview = new LinearGradientBrush {
                StartPoint = new Point(0, 0), EndPoint = new Point(1, 1),
            };

            defPreview.GradientStops.Add(new GradientStop {
                Color = VisualTheme.DarkColor, Offset = .5d
            });
            defPreview.GradientStops.Add(new GradientStop {
                Color = VisualTheme.LightColor, Offset = .5d
            });
            var def = new VisualTheme
            {
                ThemeId      = "default",
                Description  = _loader.GetString("ThemeSystemDescription"),
                FriendlyName = _loader.GetString("ThemeSystemName"),
                Theme        = ElementTheme.Default,
                Kind         = VisualThemeKind.System,
                PreviewBrush = defPreview
            };

            _themes.Add(def);
            //Light
            _themes.Add(BuildTheme(LIGHT_KEY, "ThemeLightName", true, VisualTheme.LightColor));
            //Dark
            _themes.Add(BuildTheme(DARK_KEY, "ThemeDarkName", false, VisualTheme.DarkColor));
            //Random:
            var rdmPreview = new LinearGradientBrush {
                StartPoint = new Point(0, 0), EndPoint = new Point(1, 1),
            };

            rdmPreview.GradientStops.Add(new GradientStop {
                Color = Colors.Red, Offset = 0d
            });
            rdmPreview.GradientStops.Add(new GradientStop {
                Color = Colors.Yellow, Offset = .25d
            });
            rdmPreview.GradientStops.Add(new GradientStop {
                Color = Colors.LightGreen, Offset = .50d
            });
            rdmPreview.GradientStops.Add(new GradientStop {
                Color = Colors.Teal, Offset = .75d
            });
            rdmPreview.GradientStops.Add(new GradientStop {
                Color = Colors.Violet, Offset = 1d
            });
            var rdm = new VisualTheme
            {
                ThemeId      = "random",
                FriendlyName = _loader.GetString("ThemeRandomName"),
                Description  = _loader.GetString("ThemeRandomDescription"),
                Theme        = ElementTheme.Default,
                Kind         = VisualThemeKind.Random,
                PreviewBrush = rdmPreview
            };

            _themes.Add(rdm);
            //Custom light themes:
            _themes.Add(BuildTheme("chick", "ThemeChickName", true, Color.FromArgb(255, 254, 255, 177)));
            _themes.Add(BuildTheme("lettuce", "ThemeLettuceName", true, Color.FromArgb(255, 177, 234, 175)));
            _themes.Add(BuildTheme("rosegold", "ThemeRoseGoldName", true, Color.FromArgb(255, 253, 220, 215)));
            //Custom dark themes:
            _themes.Add(BuildTheme("cobalt", "ThemeCobaltName", false, Color.FromArgb(255, 0, 71, 171)));
            _themes.Add(BuildTheme("leaf", "ThemeLeafName", false, Color.FromArgb(255, 56, 111, 54)));
            _themes.Add(BuildTheme("crimson", "ThemeCrimsonName", false, Color.FromArgb(255, 149, 0, 39)));
        }