-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Swatches and Recommended Colors
All items here mentioned live in the MaterialDesignColor project(s).
Naming Convetions:
- LONG_COLOR_NAME represents the color name as seen in Google's guide (Blue, Deep Purple, Red, Light Blue, etc).
- SHORT_COLOR_NAME represents the color name without spaces (Blue, DeepPurple, Red, LightBlue, etc).
First, we need to understand Essential Resources. They are a few resources that must be defined: The Toolkit will assume they always exist. They consist of 6 Primary Brushes, 2 Accent/Secondary Brushes, and a complete swatch set of Primary colors and Accent colors.
-
Primary Brushes:
PrimaryHueLightBrush
,PrimaryHueLightForegroundBrush
,PrimaryHueMidBrush
,PrimaryHueMidForegroundBrush
,PrimaryHueDarkBrush
,PrimaryHueDarkForegroundBrush
. -
Accent Brushes:
SecondaryAccentBrush
,SecondaryAccentForegroundBrush
. -
(Unnamed) Primary Swatch:
PrimaryXXX
andPrimaryXXXForeground
, where XXX is the intensity as seen in Google's guide (100 through 900 in increments of 100, plus 50). -
(Unnamed) Accent Swatch:
AccentXXX
andAccentXXXForeground
, where XXX is the intensity as seen in Google's guide, without the starting 'A' (100, 200, 400, and 700).
Swatches are collections of related colors hand-picked to look nice together. There are currently three types of swatches:
-
Unnamed: These contain unnamed color definitions that will be overwritten in case more than one swatch of the same type is imported. Primary swatches contain
PrimaryXXX
andPrimaryXXXForeground
, Accent swatches containAccentXXX
andAccentXXXForeground
; Where XXX is the color intensity as seen in Google's guide. They are:- Themes\MaterialDesignColor.SHORT_COLOR_NAME.Primary.xaml
- Themes\MaterialDesignColor.SHORT_COLOR_NAME.Accent.xaml
-
Named: These contain named color definitions that allow multiple swatches to be imported without overwriting each other. Primary swatches contain
LONG_COLOR_NAMEPrimaryXXX
andLONG_COLOR_NAMEPrimaryXXXForeground
, Accent swatches containLONG_COLOR_NAMEAccentXXX
andLONG_COLOR_NAMEAccentXXXForeground
; Where XXX is the color intensity as seen in Google's guide. They are:- Themes\MaterialDesignColor.SHORT_COLOR_NAME.Named.Primary.xaml
- Themes\MaterialDesignColor.SHORT_COLOR_NAME.Named.Accent.xaml
-
Legacy: These are only here for backwards compatibility and can be removed without warning at any moment. Do not use these swatches. They are:
- Themes\MaterialDesignColor.SHORT_COLOR_NAME.xaml
- Themes\MaterialDesignColor.SHORT_COLOR_NAME.Named.xaml
Defining the essential resources manually would be tedious and repetitive hard work. As such, the Recommended Colors are there to save the developer from unnecessary effort: They define the necessary brushes and import the proper swatches to make everything work just fine.
There are two types of Recommended Colors, and one of each must be imported to make them work properly:
-
Primary: These will define the Primary Brushes and Primary Swatch. They are:
- Themes\Recommended\Primary\MaterialDesignColor.SHORT_COLOR_NAME.xaml
-
Accent: These will define the Accent/Secondary Brushes and Accent/Secondary Swatch. They are:
- Themes\Recommended\Accent\MaterialDesignColor.SHORT_COLOR_NAME.xaml
The currently configured palette can be queried via PaletteHelper
. The following example illustrates how to query the current palette and set a control's background via code:
var palette = new PaletteHelper().QueryPalette();
var hue = palette.AccentSwatch.AccentHues.ToArray()[palette.AccentHueIndex];
MyBorder.Background = new SolidColorBrush(hue.Color);
If you see any mistake or want to contribute to this wiki feel free.
Home
Contributing
Compiling From Source
Glossary
Getting Started with MDIX
Getting Started
Tutorial On YouTube (português-BR)
Frequently Asked Questions
Examples Repository
Release Notes
Pack Icon Changes
2.0.0 Breaking Changes
Controls
All Control Styles
Buttons
ComboBox
Dialogs
PopupBox
Snackbar
TextBox
Toggle Button
Transitions
Icons
Theming
Advanced Theming
Brush Names
Custom Palette Hues
Fonts
Overriding Material Design Styles
Swatches and Recommended Colors
Miscellaneous
MahApps Integration
Performance
Strong Naming
.NET 4.0 Compatibility
Projects using Material Design
Understanding Routed Commands