-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrayLogFormat.cs
More file actions
59 lines (54 loc) · 1.82 KB
/
GrayLogFormat.cs
File metadata and controls
59 lines (54 loc) · 1.82 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
using System;
using System.ComponentModel.Composition;
using System.Windows.Media;
using EnvDTE;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
namespace GrayLog
{
/// <summary>
/// Set the display values for the classification
/// </summary>
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "GrayLog")]
[Name("GrayLog")]
[UserVisible(true)]
[Order(After = Priority.High)]
internal class GrayLogFormat : ClassificationFormatDefinition
{
public GrayLogFormat()
{
Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
DisplayName = "GrayLog Text"; //human readable version of the name
BackgroundOpacity = 0;
ForegroundColor = GetForegroundColorFromSettings();
}
private static Color GetForegroundColorFromSettings()
{
Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
try
{
DTE dte = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(DTE)) as DTE;
Properties props = dte?.Properties["GrayLog", "General"];
Property pathProperty = props?.Item("OptionColor");
if (pathProperty?.Value != null)
{
return UIntToColor((uint)pathProperty.Value);
}
}
catch (Exception)
{
//
}
return Color.FromRgb(84, 112, 109);
}
private static Color UIntToColor(uint color)
{
return Color.FromArgb(
(byte) (color >> 24),
(byte) (color >> 0),
(byte) (color >> 8),
(byte) (color >> 16));
}
}
}