Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add RTL support #353

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ StyleCopReport.xml
*_i.c
*_p.c
*_h.h
*.cache
*.ilk
*.meta
*.obj
Expand Down
10 changes: 5 additions & 5 deletions .nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>MaterialSkin.2</id>
<version>2.1.2</version>
<version>2.3.1</version>
<title>MaterialSkin 2</title>
<authors>leocb, IgnaceMaes</authors>
<authors>leocb, IgnaceMaes, orapps44</authors>
<owners>leocb</owners>
<license type="expression">MIT</license>
<projectUrl>https://github.com/leocb/MaterialSkin</projectUrl>
<icon>images\nugetIcon.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Google's Material Design for your windows forms.</description>
<releaseNotes>see github page for release notes</releaseNotes>
<copyright>Copyright Leonardo C Bottaro © 2020</copyright>
<copyright>Copyright Leonardo C Bottaro © 2021</copyright>
<tags>material design materialdesign google forms theme skin</tags>
<dependencies>
<group targetFramework=".NETFramework4.6.1" />
</dependencies>
<summary>The MaterialSkin 2 is a Google's Material Design skin for you windows forms app. this updated version brings new user controls, unified theming and consistency. This package superseeds the MaterialSkin package By IgnaceMaes. Example app and documentation is available on the project site. Have a quick question? Join our Slack!</summary>
<summary>The MaterialSkin 2 is a Google's Material Design skin for you windows forms app. this updated version brings new user controls, unified theming and consistency. This package superseeds the MaterialSkin package By IgnaceMaes. Example app and documentation is available on the project site.</summary>
</metadata>
<files>
<file src="nugetIcon.png" target="images\" />
<file src="MaterialSkin\bin\Release\*.dll" target="lib\net461" />
</files>
</package>
</package>
29 changes: 20 additions & 9 deletions MaterialSkin.sln
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.136
# Visual Studio Version 16
VisualStudioVersion = 16.0.30717.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialSkinExample", "MaterialSkinExample\MaterialSkinExample.csproj", "{47409AA5-62AE-4189-8E83-C471502DF5E9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialSkin", "MaterialSkin\MaterialSkin.csproj", "{8EB7611B-68CD-4B8B-987A-11717E2B250C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{17028688-3699-4BC7-849F-A6B0F6E766BC}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaterialSkinCore", "MaterialSkin\MaterialSkinCore.csproj", "{031DCCA6-79CD-41F0-AA5A-09FDE1C1D308}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialSkinExample.RTL", "MaterialSkinExample.RTL\MaterialSkinExample.RTL.csproj", "{8E08A8CF-A5DB-41DF-B486-E0E5DE552697}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialSkinExample", "MaterialSkinExample\MaterialSkinExample.csproj", "{47409AA5-62AE-4189-8E83-C471502DF5E9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{47409AA5-62AE-4189-8E83-C471502DF5E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47409AA5-62AE-4189-8E83-C471502DF5E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47409AA5-62AE-4189-8E83-C471502DF5E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47409AA5-62AE-4189-8E83-C471502DF5E9}.Release|Any CPU.Build.0 = Release|Any CPU
{8EB7611B-68CD-4B8B-987A-11717E2B250C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8EB7611B-68CD-4B8B-987A-11717E2B250C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EB7611B-68CD-4B8B-987A-11717E2B250C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EB7611B-68CD-4B8B-987A-11717E2B250C}.Release|Any CPU.Build.0 = Release|Any CPU
{031DCCA6-79CD-41F0-AA5A-09FDE1C1D308}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{031DCCA6-79CD-41F0-AA5A-09FDE1C1D308}.Debug|Any CPU.Build.0 = Debug|Any CPU
{031DCCA6-79CD-41F0-AA5A-09FDE1C1D308}.Release|Any CPU.ActiveCfg = Release|Any CPU
{031DCCA6-79CD-41F0-AA5A-09FDE1C1D308}.Release|Any CPU.Build.0 = Release|Any CPU
{8E08A8CF-A5DB-41DF-B486-E0E5DE552697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E08A8CF-A5DB-41DF-B486-E0E5DE552697}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E08A8CF-A5DB-41DF-B486-E0E5DE552697}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E08A8CF-A5DB-41DF-B486-E0E5DE552697}.Release|Any CPU.Build.0 = Release|Any CPU
{47409AA5-62AE-4189-8E83-C471502DF5E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47409AA5-62AE-4189-8E83-C471502DF5E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47409AA5-62AE-4189-8E83-C471502DF5E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47409AA5-62AE-4189-8E83-C471502DF5E9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
22 changes: 21 additions & 1 deletion MaterialSkin/ColorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,25 @@ public static Color FromHsl(int alpha, float hue, float saturation, float lighti
return Color.FromArgb(alpha, iMax, iMid, iMin);
}
}

/// <summary>
/// Removes alpha value without changing Color.
/// </summary>
/// <param name="foreground">The foreground color.</param>
/// <param name="background">The background color.</param>
/// <returns></returns>
public static Color RemoveAlpha(Color foreground, Color background)
{
if (foreground.A == 255)
return foreground;

var alpha = foreground.A / 255.0;
var diff = 1.0 - alpha;
return Color.FromArgb(255,
(byte)(foreground.R * alpha + background.R * diff),
(byte)(foreground.G * alpha + background.G * diff),
(byte)(foreground.B * alpha + background.B * diff));
}

}
}
}
32 changes: 30 additions & 2 deletions MaterialSkin/ColorScheme.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MaterialSkin
namespace MaterialSkin
{
using System.Drawing;

Expand All @@ -10,6 +10,10 @@ public class ColorScheme

public readonly Brush PrimaryBrush, DarkPrimaryBrush, LightPrimaryBrush, AccentBrush, TextBrush;

public ColorScheme() : this(Primary.Indigo500, Primary.Indigo700, Primary.Indigo100, Accent.Pink200, TextShade.WHITE)
{
}

public ColorScheme(Primary primary, Primary darkPrimary, Primary lightPrimary, Accent accent, TextShade textShade)
{
//Color
Expand All @@ -34,6 +38,30 @@ public ColorScheme(Primary primary, Primary darkPrimary, Primary lightPrimary, A
TextBrush = new SolidBrush(TextColor);
}

public ColorScheme(int primary, int darkPrimary, int lightPrimary, int accent, TextShade textShade)
{
//Color
PrimaryColor = ((int)primary).ToColor();
DarkPrimaryColor = ((int)darkPrimary).ToColor();
LightPrimaryColor = ((int)lightPrimary).ToColor();
AccentColor = ((int)accent).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(Color primary, Color darkPrimary, Color lightPrimary, Color accent, TextShade textShade)
{
//Color
Expand Down Expand Up @@ -327,4 +355,4 @@ public enum Accent
DeepOrange400 = 0xFF3D00,
DeepOrange700 = 0xDD2C00
}
}
}
Loading