diff --git a/MaterialSkin/ColorScheme.cs b/MaterialSkin/ColorScheme.cs index af25baf4..5e870aaf 100644 --- a/MaterialSkin/ColorScheme.cs +++ b/MaterialSkin/ColorScheme.cs @@ -1,5 +1,6 @@ namespace MaterialSkin { + using System; using System.Drawing; public class ColorScheme @@ -38,6 +39,59 @@ public ColorScheme(Primary primary, Primary darkPrimary, Primary lightPrimary, A TextBrush = new SolidBrush(TextColor); } + private int GetIntFromHexColor(string HexColor) + { + //#ffffff // #ffffffff + try + { + if (HexColor.Length <= 9 || HexColor.Length >= 2) + { + if (HexColor[0] == '#') + { + return Convert.ToInt32(HexColor.Replace("#", "0x"), 16); + } + else + { + return Convert.ToInt32(HexColor.Insert(0, "0x"), 16); + } + + } + } + catch + { + return 0x00; + } + return 0x00; + } + + public ColorScheme(string customPrimary, string customDarkPrimary, string customLightPrimary, string customAccent, TextShade textShade) + { + //Color + /*PrimaryColor = ((int)new System.ComponentModel.Int32Converter().ConvertFromString(customPrimary)).ToColor(); + DarkPrimaryColor = ((int)new System.ComponentModel.Int32Converter().ConvertFromString(customDarkPrimary)).ToColor(); + LightPrimaryColor = ((int)new System.ComponentModel.Int32Converter().ConvertFromString(customLightPrimary)).ToColor(); + AccentColor = ((int)new System.ComponentModel.Int32Converter().ConvertFromString(customAccent)).ToColor();*/ + PrimaryColor = GetIntFromHexColor(customPrimary).ToColor(); + DarkPrimaryColor = GetIntFromHexColor(customDarkPrimary).ToColor(); + LightPrimaryColor = GetIntFromHexColor(customLightPrimary).ToColor(); + AccentColor = GetIntFromHexColor(customAccent).ToColor(); + TextColor = ((int)textShade).ToColor(); + + //Pen + PrimaryPen = new Pen(PrimaryColor); + DarkPrimaryPen = new Pen(DarkPrimaryColor); + LightPrimaryPen = new Pen(LightPrimaryColor); + AccentPen = new Pen(AccentColor); + TextPen = new Pen(TextColor); + + //Brush + PrimaryBrush = new SolidBrush(PrimaryColor); + DarkPrimaryBrush = new SolidBrush(DarkPrimaryColor); + LightPrimaryBrush = new SolidBrush(LightPrimaryColor); + AccentBrush = new SolidBrush(AccentColor); + TextBrush = new SolidBrush(TextColor); + } + public ColorScheme(int primary, int darkPrimary, int lightPrimary, int accent, TextShade textShade) { //Color diff --git a/MaterialSkin/MaterialSkin.csproj b/MaterialSkin/MaterialSkin.csproj index a9e04a3a..78de4dd9 100644 --- a/MaterialSkin/MaterialSkin.csproj +++ b/MaterialSkin/MaterialSkin.csproj @@ -9,7 +9,7 @@ Properties MaterialSkin MaterialSkin - v4.6.1 + v4.8 512 diff --git a/MaterialSkin/Properties/Resources.Designer.cs b/MaterialSkin/Properties/Resources.Designer.cs index bed21124..47395ec7 100644 --- a/MaterialSkin/Properties/Resources.Designer.cs +++ b/MaterialSkin/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace MaterialSkin.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { diff --git a/MaterialSkin/Properties/Settings.Designer.cs b/MaterialSkin/Properties/Settings.Designer.cs index 0efe634d..77b38dc9 100644 --- a/MaterialSkin/Properties/Settings.Designer.cs +++ b/MaterialSkin/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace MaterialSkin.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/MaterialSkinExample/App.config b/MaterialSkinExample/App.config index 51847c70..a86c6465 100644 --- a/MaterialSkinExample/App.config +++ b/MaterialSkinExample/App.config @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/MaterialSkinExample/MaterialSkinExample.csproj b/MaterialSkinExample/MaterialSkinExample.csproj index 362502d7..15bde403 100644 --- a/MaterialSkinExample/MaterialSkinExample.csproj +++ b/MaterialSkinExample/MaterialSkinExample.csproj @@ -9,7 +9,7 @@ Properties MaterialSkinExample MaterialSkinExample - v4.6.1 + v4.8 512 @@ -142,4 +142,4 @@ --> - + \ No newline at end of file diff --git a/MaterialSkinExample/Properties/Resources.Designer.cs b/MaterialSkinExample/Properties/Resources.Designer.cs index eccbad9e..de8e1d5b 100644 --- a/MaterialSkinExample/Properties/Resources.Designer.cs +++ b/MaterialSkinExample/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace MaterialSkinExample.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -131,7 +131,7 @@ internal static System.Drawing.Bitmap plus { } /// - /// Recherche une ressource localisée de type System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap round_add_black_24dp { get { @@ -211,7 +211,7 @@ internal static System.Drawing.Bitmap round_http_white_24dp { } /// - /// Recherche une ressource localisée de type System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap round_phone_black_24dp { get { @@ -219,7 +219,7 @@ internal static System.Drawing.Bitmap round_phone_black_24dp { return ((System.Drawing.Bitmap)(obj)); } } - + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/MaterialSkinExample/Properties/Settings.Designer.cs b/MaterialSkinExample/Properties/Settings.Designer.cs index 5f02ea1d..ab67e4e8 100644 --- a/MaterialSkinExample/Properties/Settings.Designer.cs +++ b/MaterialSkinExample/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace MaterialSkinExample.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));