diff --git a/src/MainDemo.Wpf/Buttons.xaml b/src/MainDemo.Wpf/Buttons.xaml
index c5a8b6b33f..feec76eca1 100644
--- a/src/MainDemo.Wpf/Buttons.xaml
+++ b/src/MainDemo.Wpf/Buttons.xaml
@@ -2,10 +2,11 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:sharedDomain="clr-namespace:MaterialDesignDemo.Shared.Domain;assembly=MaterialDesignDemo.Shared"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:materialDesignConverters="clr-namespace:MaterialDesignThemes.Wpf.Converters;assembly=MaterialDesignThemes.Wpf"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:sharedDomain="clr-namespace:MaterialDesignDemo.Shared.Domain;assembly=MaterialDesignDemo.Shared"
+ xmlns:sharedButtons="clr-namespace:MaterialDesignDemo.Shared.Examples.Buttons;assembly=MaterialDesignDemo.Shared"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
xmlns:system="clr-namespace:System;assembly=mscorlib"
d:DataContext="{d:DesignInstance sharedDomain:ButtonsViewModel}"
@@ -498,6 +499,10 @@
+
+
+
+
@@ -969,7 +974,6 @@
diff --git a/src/MainDemo.Wpf/ColorTool.xaml b/src/MainDemo.Wpf/ColorTool.xaml
index 582b92f14c..489423a7fa 100644
--- a/src/MainDemo.Wpf/ColorTool.xaml
+++ b/src/MainDemo.Wpf/ColorTool.xaml
@@ -4,6 +4,7 @@
xmlns:converters="clr-namespace:MaterialDesignDemo.Shared.Converters;assembly=MaterialDesignDemo.Shared"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:sharedDomain="clr-namespace:MaterialDesignDemo.Shared.Domain;assembly=MaterialDesignDemo.Shared"
+ xmlns:sharedColorTools="clr-namespace:MaterialDesignDemo.Shared.Examples.ColorTools;assembly=MaterialDesignDemo.Shared"
xmlns:local="clr-namespace:MaterialDesignDemo"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:materialDesignColors="clr-namespace:MaterialDesignColors;assembly=MaterialDesignColors"
@@ -124,6 +125,11 @@
+
+
+
+
+
diff --git a/src/MaterialDesign3.Demo.Wpf/Buttons.xaml b/src/MaterialDesign3.Demo.Wpf/Buttons.xaml
index 265bb03e9b..33c84816ea 100644
--- a/src/MaterialDesign3.Demo.Wpf/Buttons.xaml
+++ b/src/MaterialDesign3.Demo.Wpf/Buttons.xaml
@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:sharedDomain="clr-namespace:MaterialDesignDemo.Shared.Domain;assembly=MaterialDesignDemo.Shared"
+ xmlns:sharedButtons="clr-namespace:MaterialDesignDemo.Shared.Examples.Buttons;assembly=MaterialDesignDemo.Shared"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:materialDesignConverters="clr-namespace:MaterialDesignThemes.Wpf.Converters;assembly=MaterialDesignThemes.Wpf"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -511,6 +512,9 @@
+
+
+
diff --git a/src/MaterialDesign3.Demo.Wpf/ColorTool.xaml b/src/MaterialDesign3.Demo.Wpf/ColorTool.xaml
index 2042d4a322..7a03dff3c4 100644
--- a/src/MaterialDesign3.Demo.Wpf/ColorTool.xaml
+++ b/src/MaterialDesign3.Demo.Wpf/ColorTool.xaml
@@ -4,6 +4,7 @@
xmlns:converters="clr-namespace:MaterialDesignDemo.Shared.Converters;assembly=MaterialDesignDemo.Shared"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:sharedDomain="clr-namespace:MaterialDesignDemo.Shared.Domain;assembly=MaterialDesignDemo.Shared"
+ xmlns:sharedColorTools="clr-namespace:MaterialDesignDemo.Shared.Examples.ColorTools;assembly=MaterialDesignDemo.Shared"
xmlns:local="clr-namespace:MaterialDesign3Demo"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:materialDesignColors="clr-namespace:MaterialDesignColors;assembly=MaterialDesignColors"
@@ -121,6 +122,11 @@
+
+
+
+
+
diff --git a/src/MaterialDesignDemo.Shared/Examples/Buttons/SemanticColoredButtonsExample.xaml b/src/MaterialDesignDemo.Shared/Examples/Buttons/SemanticColoredButtonsExample.xaml
new file mode 100644
index 0000000000..a4b65a7184
--- /dev/null
+++ b/src/MaterialDesignDemo.Shared/Examples/Buttons/SemanticColoredButtonsExample.xaml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MaterialDesignDemo.Shared/Examples/Buttons/SemanticColoredButtonsExample.xaml.cs b/src/MaterialDesignDemo.Shared/Examples/Buttons/SemanticColoredButtonsExample.xaml.cs
new file mode 100644
index 0000000000..d7d2b65739
--- /dev/null
+++ b/src/MaterialDesignDemo.Shared/Examples/Buttons/SemanticColoredButtonsExample.xaml.cs
@@ -0,0 +1,9 @@
+namespace MaterialDesignDemo.Shared.Examples.Buttons;
+
+public partial class SemanticColoredButtonsExample : UserControl
+{
+ public SemanticColoredButtonsExample()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/src/MaterialDesignDemo.Shared/Examples/ColorTools/SemanticColorsExamples.xaml b/src/MaterialDesignDemo.Shared/Examples/ColorTools/SemanticColorsExamples.xaml
new file mode 100644
index 0000000000..20b45b8717
--- /dev/null
+++ b/src/MaterialDesignDemo.Shared/Examples/ColorTools/SemanticColorsExamples.xaml
@@ -0,0 +1,235 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MaterialDesignDemo.Shared/Examples/ColorTools/SemanticColorsExamples.xaml.cs b/src/MaterialDesignDemo.Shared/Examples/ColorTools/SemanticColorsExamples.xaml.cs
new file mode 100644
index 0000000000..03c9799b17
--- /dev/null
+++ b/src/MaterialDesignDemo.Shared/Examples/ColorTools/SemanticColorsExamples.xaml.cs
@@ -0,0 +1,20 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+
+namespace MaterialDesignDemo.Shared.Examples.ColorTools;
+
+public partial class SemanticColorsExamples : UserControl
+{
+ public SemanticColorsExamples()
+ {
+ DataContext = new SemanticColorsViewModel();
+ InitializeComponent();
+ }
+}
+
+public partial class SemanticColorsViewModel : ObservableObject
+{
+ [RelayCommand]
+ private void CopyResource(string resourceKey)
+ => System.Windows.Clipboard.SetText(resourceKey);
+}
diff --git a/src/MaterialDesignThemes.Wpf/ResourceDictionaryExtensions.g.cs b/src/MaterialDesignThemes.Wpf/ResourceDictionaryExtensions.g.cs
index 4701fc10ad..aaa4ad3e80 100644
--- a/src/MaterialDesignThemes.Wpf/ResourceDictionaryExtensions.g.cs
+++ b/src/MaterialDesignThemes.Wpf/ResourceDictionaryExtensions.g.cs
@@ -11,9 +11,13 @@ static partial class ResourceDictionaryExtensions
private static partial void LoadThemeColors(ResourceDictionary resourceDictionary, Theme theme)
{
theme.Background = GetColor(resourceDictionary, "MaterialDesign.Brush.Background", "MaterialDesignPaper");
+ theme.Error = GetColor(resourceDictionary, "MaterialDesign.Brush.Error");
theme.Foreground = GetColor(resourceDictionary, "MaterialDesign.Brush.Foreground", "MaterialDesignBody");
theme.ForegroundLight = GetColor(resourceDictionary, "MaterialDesign.Brush.ForegroundLight", "MaterialDesignBodyLight", "MaterialDesignCheckBoxOff", "MaterialDesignTextBoxBorder");
+ theme.Info = GetColor(resourceDictionary, "MaterialDesign.Brush.Info");
+ theme.Success = GetColor(resourceDictionary, "MaterialDesign.Brush.Success");
theme.ValidationError = GetColor(resourceDictionary, "MaterialDesign.Brush.ValidationError", "MaterialDesignValidationErrorBrush");
+ theme.Warning = GetColor(resourceDictionary, "MaterialDesign.Brush.Warning");
theme.Badgeds.DarkBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.Badged.DarkBackground");
theme.Badgeds.DarkForeground = GetColor(resourceDictionary, "MaterialDesign.Brush.Badged.DarkForeground");
theme.Badgeds.LightBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.Badged.LightBackground");
@@ -105,14 +109,18 @@ private static partial void ApplyThemeColors(ResourceDictionary resourceDictiona
{
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Background", theme.Background);
SetSolidColorBrush(resourceDictionary, "MaterialDesignPaper", theme.Background);
+ SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Error", theme.Error);
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Foreground", theme.Foreground);
SetSolidColorBrush(resourceDictionary, "MaterialDesignBody", theme.Foreground);
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.ForegroundLight", theme.ForegroundLight);
SetSolidColorBrush(resourceDictionary, "MaterialDesignBodyLight", theme.ForegroundLight);
SetSolidColorBrush(resourceDictionary, "MaterialDesignCheckBoxOff", theme.ForegroundLight);
SetSolidColorBrush(resourceDictionary, "MaterialDesignTextBoxBorder", theme.ForegroundLight);
+ SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Info", theme.Info);
+ SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Success", theme.Success);
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.ValidationError", theme.ValidationError);
SetSolidColorBrush(resourceDictionary, "MaterialDesignValidationErrorBrush", theme.ValidationError);
+ SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Warning", theme.Warning);
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Badged.DarkBackground", theme.Badgeds.DarkBackground);
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Badged.DarkForeground", theme.Badgeds.DarkForeground);
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Badged.LightBackground", theme.Badgeds.LightBackground);
diff --git a/src/MaterialDesignThemes.Wpf/Theme.g.cs b/src/MaterialDesignThemes.Wpf/Theme.g.cs
index 9ea4eaa13c..a72fb4ddb8 100644
--- a/src/MaterialDesignThemes.Wpf/Theme.g.cs
+++ b/src/MaterialDesignThemes.Wpf/Theme.g.cs
@@ -44,6 +44,13 @@ public ColorReference Background
set => _background = value;
}
+ private ColorReference _error;
+ public ColorReference Error
+ {
+ get => Resolve(_error);
+ set => _error = value;
+ }
+
private ColorReference _foreground;
public ColorReference Foreground
{
@@ -58,6 +65,20 @@ public ColorReference ForegroundLight
set => _foregroundLight = value;
}
+ private ColorReference _info;
+ public ColorReference Info
+ {
+ get => Resolve(_info);
+ set => _info = value;
+ }
+
+ private ColorReference _success;
+ public ColorReference Success
+ {
+ get => Resolve(_success);
+ set => _success = value;
+ }
+
private ColorReference _validationError;
public ColorReference ValidationError
{
@@ -65,6 +86,13 @@ public ColorReference ValidationError
set => _validationError = value;
}
+ private ColorReference _warning;
+ public ColorReference Warning
+ {
+ get => Resolve(_warning);
+ set => _warning = value;
+ }
+
public Badged Badgeds { get; set; }
public Button Buttons { get; set; }
diff --git a/src/MaterialDesignThemes.Wpf/ThemeExtensions.g.cs b/src/MaterialDesignThemes.Wpf/ThemeExtensions.g.cs
index cb5e6391b1..c84ec8ecd4 100644
--- a/src/MaterialDesignThemes.Wpf/ThemeExtensions.g.cs
+++ b/src/MaterialDesignThemes.Wpf/ThemeExtensions.g.cs
@@ -16,9 +16,13 @@ static partial class ThemeExtensions
public static partial void SetLightTheme(this Theme theme)
{
theme.Background = BaseThemeColors.Neutral900;
+ theme.Error = Color.FromArgb(0xFF, 0xF4, 0x43, 0x36);
theme.Foreground = BaseThemeColors.Black900;
theme.ForegroundLight = BaseThemeColors.Black500;
+ theme.Info = Color.FromArgb(0xFF, 0x21, 0x96, 0xF3);
+ theme.Success = Color.FromArgb(0xFF, 0x00, 0xC8, 0x53);
theme.ValidationError = Color.FromArgb(0xFF, 0xB0, 0x00, 0x20);
+ theme.Warning = Color.FromArgb(0xFF, 0xFF, 0x98, 0x00);
theme.Badgeds.DarkBackground = BaseThemeColors.Neutral100;
theme.Badgeds.DarkForeground = BaseThemeColors.Neutral900;
theme.Badgeds.LightBackground = BaseThemeColors.Neutral900;
@@ -109,9 +113,13 @@ public static partial void SetLightTheme(this Theme theme)
public static partial void SetDarkTheme(this Theme theme)
{
theme.Background = BaseThemeColors.Neutral100;
+ theme.Error = Color.FromArgb(0xFF, 0xFF, 0x3F, 0x5F);
theme.Foreground = BaseThemeColors.White900;
theme.ForegroundLight = BaseThemeColors.White500;
+ theme.Info = Color.FromArgb(0xFF, 0x4A, 0x86, 0xFF);
+ theme.Success = Color.FromArgb(0xFF, 0x3D, 0xCB, 0x6C);
theme.ValidationError = Color.FromArgb(0xFF, 0xCF, 0x66, 0x79);
+ theme.Warning = Color.FromArgb(0xFF, 0xFF, 0xB5, 0x45);
theme.Badgeds.DarkBackground = BaseThemeColors.Neutral100;
theme.Badgeds.DarkForeground = BaseThemeColors.Neutral900;
theme.Badgeds.LightBackground = BaseThemeColors.Neutral900;
diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml
index c4d66b89a1..a3356b3971 100644
--- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml
+++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml
@@ -41,6 +41,7 @@
+
@@ -58,6 +59,7 @@
+
@@ -76,6 +78,7 @@
+
@@ -95,5 +98,6 @@
+
diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml
index fed8cff81b..34c5d9d324 100644
--- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml
+++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml
@@ -41,6 +41,7 @@
+
@@ -58,6 +59,7 @@
+
@@ -76,6 +78,7 @@
+
@@ -95,5 +98,6 @@
+
diff --git a/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json b/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json
index 33e51770af..8d57f7eada 100644
--- a/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json
+++ b/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json
@@ -715,5 +715,41 @@
"obsoleteKeys": [
"MaterialDesignSelection"
]
+ },
+ {
+ "name": "MaterialDesign.Brush.Error",
+ "themeValues": {
+ "light": "#F44336",
+ "dark": "#FF3F5F"
+ },
+ "alternateKeys": [],
+ "obsoleteKeys": []
+ },
+ {
+ "name": "MaterialDesign.Brush.Warning",
+ "themeValues": {
+ "light": "#FF9800",
+ "dark": "#FFB545"
+ },
+ "alternateKeys": [],
+ "obsoleteKeys": []
+ },
+ {
+ "name": "MaterialDesign.Brush.Success",
+ "themeValues": {
+ "light": "#00C853",
+ "dark": "#3DCB6C"
+ },
+ "alternateKeys": [],
+ "obsoleteKeys": []
+ },
+ {
+ "name": "MaterialDesign.Brush.Info",
+ "themeValues": {
+ "light": "#2196F3",
+ "dark": "#4A86FF"
+ },
+ "alternateKeys": [],
+ "obsoleteKeys": []
}
]
diff --git a/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs b/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs
index cc047b0b40..abedfa4d00 100644
--- a/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs
+++ b/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs
@@ -22,9 +22,13 @@ private partial string GetXamlWrapPanel()
+
+
+
+
@@ -193,6 +197,11 @@ private partial async Task AssertAllThemeBrushesSet(IVisualElement pa
Color? textBlockBackground = await textBlock.GetBackgroundColor();
await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.Background"));
}
+ {
+ IVisualElement textBlock = await panel.GetElement("[Text=\"Error\"]");
+ Color? textBlockBackground = await textBlock.GetBackgroundColor();
+ await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.Error"));
+ }
{
IVisualElement textBlock = await panel.GetElement("[Text=\"Foreground\"]");
Color? textBlockBackground = await textBlock.GetBackgroundColor();
@@ -203,11 +212,26 @@ private partial async Task AssertAllThemeBrushesSet(IVisualElement pa
Color? textBlockBackground = await textBlock.GetBackgroundColor();
await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.ForegroundLight"));
}
+ {
+ IVisualElement textBlock = await panel.GetElement("[Text=\"Info\"]");
+ Color? textBlockBackground = await textBlock.GetBackgroundColor();
+ await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.Info"));
+ }
+ {
+ IVisualElement textBlock = await panel.GetElement("[Text=\"Success\"]");
+ Color? textBlockBackground = await textBlock.GetBackgroundColor();
+ await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.Success"));
+ }
{
IVisualElement textBlock = await panel.GetElement("[Text=\"ValidationError\"]");
Color? textBlockBackground = await textBlock.GetBackgroundColor();
await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.ValidationError"));
}
+ {
+ IVisualElement textBlock = await panel.GetElement("[Text=\"Warning\"]");
+ Color? textBlockBackground = await textBlock.GetBackgroundColor();
+ await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.Warning"));
+ }
{
IVisualElement textBlock = await panel.GetElement("[Text=\"Badged.DarkBackground\"]");
Color? textBlockBackground = await textBlock.GetBackgroundColor();
@@ -942,9 +966,13 @@ private partial async Task AssertAllThemeBrushesSet(IVisualElement pa
private static IEnumerable GetBrushResourceNames()
{
yield return "MaterialDesign.Brush.Background";
+ yield return "MaterialDesign.Brush.Error";
yield return "MaterialDesign.Brush.Foreground";
yield return "MaterialDesign.Brush.ForegroundLight";
+ yield return "MaterialDesign.Brush.Info";
+ yield return "MaterialDesign.Brush.Success";
yield return "MaterialDesign.Brush.ValidationError";
+ yield return "MaterialDesign.Brush.Warning";
yield return "MaterialDesign.Brush.Badged.DarkBackground";
yield return "MaterialDesign.Brush.Badged.DarkForeground";
yield return "MaterialDesign.Brush.Badged.LightBackground";