How make MaterialDesignInXamlToolkit Custom Color Theme?

FrancoTampieri picture FrancoTampieri · Oct 18, 2016 · Viewed 7.4k times · Source

I have to make a personal colot theme with custom accent and primary color palette.

Is possible to create a resource dictonary in my project with new custom palette?

Can you show me a sample?

Best Regards

Franco

Answer

James Willock picture James Willock · Oct 18, 2016

To create a custom palette, define your brushes manually in your App.xaml e.g.:

<!-- primary hues  -->
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="LightBlue"/>
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="Black"/>
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="Blue"/>
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="White"/>
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="DarkBlue"/>
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="White"/>
<!--  accent -->
<SolidColorBrush x:Key="SecondaryAccentBrush" Color="Yellow"/>
<SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="Black"/>

In this example you wouldn't merge in your two palettes from the Colors assembly.

For more information see:

https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/wiki/Custom-Palette-Hues