forked from fdorg/flashdevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThemedColors.cs
More file actions
87 lines (65 loc) · 2.14 KB
/
ThemedColors.cs
File metadata and controls
87 lines (65 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* This code is provided under the Code Project Open Licence (CPOL)
* See http://www.codeproject.com/info/cpol10.aspx for details
*/
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
namespace System.Drawing
{
internal sealed class ThemedColors
{
#region " Variables and Constants "
private const string NormalColor = "NormalColor";
private const string HomeStead = "HomeStead";
private const string Metallic = "Metallic";
private const string NoTheme = "NoTheme";
private static Color[] _toolBorder;
#endregion
#region " Properties "
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public static ColorScheme CurrentThemeIndex {
get { return ThemedColors.GetCurrentThemeIndex(); }
}
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public static Color ToolBorder {
get { return ThemedColors._toolBorder[(int)ThemedColors.CurrentThemeIndex]; }
}
#endregion
#region " Constructors "
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
static ThemedColors() {
ThemedColors._toolBorder = new Color[] {Color.FromArgb(127, 157, 185), Color.FromArgb(164, 185, 127), Color.FromArgb(165, 172, 178), Color.FromArgb(132, 130, 132)};
}
private ThemedColors(){}
#endregion
private static ColorScheme GetCurrentThemeIndex()
{
ColorScheme theme = ColorScheme.NoTheme;
if (VisualStyleInformation.IsSupportedByOS && VisualStyleInformation.IsEnabledByUser && Application.RenderWithVisualStyles)
{
switch (VisualStyleInformation.ColorScheme) {
case NormalColor:
theme = ColorScheme.NormalColor;
break;
case HomeStead:
theme = ColorScheme.HomeStead;
break;
case Metallic:
theme = ColorScheme.Metallic;
break;
default:
theme = ColorScheme.NoTheme;
break;
}
}
return theme;
}
public enum ColorScheme
{
NormalColor = 0,
HomeStead = 1,
Metallic = 2,
NoTheme = 3
}
}
}