Changing colors of (Fluent) theme

1 Answer 38 Views
Styling
Philipp
Top achievements
Rank 2
Iron
Philipp asked on 20 Dec 2021, 07:59 AM | edited on 20 Dec 2021, 07:59 AM

Hello,

In my application I try to change the colors from Fluent theme globaly. Unfortunately it seems my changes are ignored. I'm wondering what I'm doing wrong.

To exclude any side effect related to my application I created a new WPF program (.Net Core 5) that just contains a Splash screen and a NavigationView to check if the theme settings are applied. Source code of this test program is attached.

Steps I did to change the theme:

1: I set Fluent theme as the theme of the application (according to Setting a theme using stylemanager). This works fine. Splashscreen and NavigationView appear in Fluent theme.

2: I used color theme generator (Color theme generator) to adapt the colors and copied generated code to clipboard. Pasted the code next to theme setting from 1 (tried both, before and after setting theme)

The settings are done in App.xaml.cs. My test change to Fluent theme is that I change every color to red. When I execute the program, Fluent theme looks normal (blue color, See screenshots). My expectation was that I see a lot of red.

This is the code how I try to adapt the theme:

namespace TelerikStyle
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Set the theme
            SetTheme();

            // Show dummy splash screen
            var dataContext = (SplashScreenDataContext)RadSplashScreenManager.SplashScreenDataContext;
            dataContext.Content = "Loading Application";
            dataContext.Footer = "";
            RadSplashScreenManager.Show();
            Thread.Sleep(5000);
            RadSplashScreenManager.Close();
        }

        private void SetTheme()
        {
            StyleManager.ApplicationTheme = new FluentTheme();

            FluentPalette.Palette.AccentColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.AccentFocusedColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.AccentMouseOverColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.AccentPressedColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.AlternativeColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.BasicColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.BasicSolidColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.ComplementaryColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.IconColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MainColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MarkerColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MarkerInvertedColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MarkerMouseOverColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MouseOverColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.PressedColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.PrimaryBackgroundColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.PrimaryColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.PrimaryMouseOverColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.ReadOnlyBackgroundColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.ReadOnlyBorderColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.ValidationColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.DisabledOpacity = 0.3;
            FluentPalette.Palette.InputOpacity = 0.6;
            FluentPalette.Palette.ReadOnlyOpacity = 0.5;
        }
    }
}

 

Any ideas what I miss?

Thanks and Regards

Philipp

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 22 Dec 2021, 03:22 PM

Hello Phillip,

This issue is described here: https://docs.telerik.com/devtools/wpf/knowledge-base/kb-splashscreen-palette-settings-not-working

Basically, you will need to create a separate UserControl hosting RadSplashScreen and apply the palette in its constructor. I've updated your project to show this approach. I hope that helps.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Philipp
Top achievements
Rank 2
Iron
commented on 03 Jan 2022, 06:38 AM

Hello Martin and happy new year,

sorry for the late response.

Good information, thanks. Knowing that it is clear why it behaves this way. The described solution and your example work for me. Thank you.

Regards

Philipp

Martin Ivanov
Telerik team
commented on 03 Jan 2022, 08:10 AM

It is great to hear that. Happy New Year!
Tags
Styling
Asked by
Philipp
Top achievements
Rank 2
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or