Is there a way to extract active theme settings from the StyleManager?
Cheers, Rob.
1 Answer, 1 is accepted
0
Dilyan Traykov
Telerik team
answered on 27 Jan 2021, 01:11 PM
Hi Rob,
I assume that by settings you mean the palette colors, font sizes, opacities, and other theme-related values. If that is the case, you can do so by determining the current theme through the StyleManager.ApplicationTheme property and accessing its respective Palette property:
var theme = StyleManager.ApplicationTheme;
if (theme is MaterialTheme)
{
var materialPalette = MaterialPalette.Palette;
var accentColor = materialPalette.AccentNormalColor;
var mainColor = materialPalette.MainColor;
// ...
}
elseif (theme is FluentTheme)
{
var fluentPalette = FluentPalette.Palette;
var accentColor = fluentPalette.AccentColor;
var mainColor = fluentPalette.MainColor;
// ...
}
// ...
Please note that this is only possible for the themes which support palettes such as Office2019, Office2016, Material, Fluent etc.
You can also have a look at our Color Theme Generator application which allows you to experiment with the theme colors and immediately see the results.
Please let me know if this is what you have in mind and whether you found this helpful.
Regards,
Dilyan Traykov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.