diff --git a/README.md b/README.md index 0c655f8..ae64866 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ public class AuthentificationDialog : DialogContext protected override void OnConfiguring(DialogContextOptionsBuilder builder) { - builder.UseStyle(DialogStyle.Material) + builder.UseMaterialStyle() .WithTitle("Authentification") .WithButton("Sign in"); @@ -53,6 +53,7 @@ Base items that available "out of the box": - NumericUpDownItem (decimal/int) - CheckBoxItem (bool) - ComboBoxItem (Collection) +- ListBoxItem (Collection) - DateTimePickerItem (DateTime) You can use your own control as dialog item by inerhiting from BaseDialogItem: @@ -75,6 +76,46 @@ protected override void OnConfiguring(DialogContextOptionsBuilder builder) } ``` +## Themes +Material style has only two themes - Dark and Light, but it also supports color schemes, for using them you can use constant schemes from **MaterialColorScheme**: +```csharp +builder.UseMaterialStyle(MaterialTheme.Light, MaterialColorScheme.Indigo) +``` +Or create your own, there is tons of available colors [here](https://github.com/bubuntoid/EasyDialog/blob/main/src/EasyDialog/Enums/MaterialThemePrimaryColor.cs): +```csharp +var scheme = new MaterialColorScheme() +{ + Primary = MaterialThemePrimaryColor.BlueGrey800, + DarkPrimary = MaterialThemePrimaryColor.BlueGrey900, + LightPrimary = MaterialThemePrimaryColor.BlueGrey500, + Accent = MaterialThemeAccent.LightBlue200, + TextShade = MaterialThemeTextShade.White, +}; + +builder.UseMaterialStyle(MaterialTheme.Dark, scheme) +``` +Available color schemes: +- Default +- Green +- LightGreen +- Red +- Amber +- Brown +- Teal +- Yellow +- Pink +- Purple +- DeepPurple +- Orange +- DeepOrange +- Lime +- LightBlue +- Indigo +- Grey +- Cyan + +[Metro style themes](https://github.com/bubuntoid/EasyDialog/blob/main/src/EasyDialog/Enums/MetroTheme.cs). + ## Dependencies - System.Windows.Forms 4.0.0.0 - [MetroFramework](https://github.com/thielj/MetroFramework) 1.2.0.3 diff --git a/src/EasyDialog.Tests/Implementation/AuthentificationDialog.cs b/src/EasyDialog.Tests/Implementation/AuthentificationDialog.cs index c2e7e6a..19216b8 100644 --- a/src/EasyDialog.Tests/Implementation/AuthentificationDialog.cs +++ b/src/EasyDialog.Tests/Implementation/AuthentificationDialog.cs @@ -10,7 +10,7 @@ public class AuthentificationDialog : DialogContext protected override void OnConfiguring(DialogContextOptionsBuilder builder) { - builder.UseMaterialStyle(MaterialTheme.Light, MaterialColorScheme.Cyan) + builder.UseMaterialStyle(MaterialTheme.Dark, MaterialColorScheme.Indigo) .WithTitle("Authentification") .WithButton("Sign in"); diff --git a/src/EasyDialog/Internal/Forms/Implementations/MaterialFormProvider.cs b/src/EasyDialog/Internal/Forms/Implementations/MaterialFormProvider.cs index 66c564b..8d3d5e0 100644 --- a/src/EasyDialog/Internal/Forms/Implementations/MaterialFormProvider.cs +++ b/src/EasyDialog/Internal/Forms/Implementations/MaterialFormProvider.cs @@ -46,8 +46,13 @@ public MaterialFormProvider(MaterialTheme theme, MaterialColorScheme colorScheme Sizable = false }; + var defaultLabel = new Label(); + var defaultFontFamilyName = defaultLabel.Font.FontFamily.Name; + var defaultLabelSize = defaultLabel.Font.Size; + defaultLabel.Dispose(); + var materialSkinManager = MaterialSkinManager.Instance; - materialSkinManager.ROBOTO_REGULAR_11 = new System.Drawing.Font(materialSkinManager.ROBOTO_MEDIUM_10.FontFamily.Name, 10); + materialSkinManager.ROBOTO_REGULAR_11 = new System.Drawing.Font(defaultFontFamilyName, defaultLabelSize); materialSkinManager.AddFormToManage(form); materialSkinManager.Theme = (MaterialSkinManager.Themes)theme; materialSkinManager.ColorScheme = new ColorScheme(