Skip to content

Commit 5edaaaa

Browse files
committed
Color adjustments dependent on the scheme
1 parent 485f779 commit 5edaaaa

File tree

5 files changed

+43
-4
lines changed

5 files changed

+43
-4
lines changed

AutoItSyntaxHighlight/AutoItSyntaxHighlight.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
<HintPath>..\packages\Microsoft.VisualStudio.CoreUtility.14.2.25123\lib\net45\Microsoft.VisualStudio.CoreUtility.dll</HintPath>
8989
<Private>True</Private>
9090
</Reference>
91+
<Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
92+
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
9193
<Reference Include="Microsoft.VisualStudio.Text.Data, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
9294
<HintPath>..\packages\Microsoft.VisualStudio.Text.Data.14.2.25123\lib\net45\Microsoft.VisualStudio.Text.Data.dll</HintPath>
9395
<Private>True</Private>
@@ -110,6 +112,7 @@
110112
<Reference Include="System.ComponentModel.Composition" />
111113
<Reference Include="System.Data" />
112114
<Reference Include="System.Data.DataSetExtensions" />
115+
<Reference Include="System.Drawing" />
113116
<Reference Include="System.Xaml" />
114117
<Reference Include="System.Xml" />
115118
<Reference Include="WindowsBase" />

AutoItSyntaxHighlight/ClassificationFormats/AutoItEditorCommentClassifierFormat.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using System.Windows.Media;
1818
using Microsoft.VisualStudio.Text.Classification;
1919
using Microsoft.VisualStudio.Utilities;
20+
using Microsoft.VisualStudio.PlatformUI;
2021

2122
namespace AutoItSyntaxHighlight.ClassificationFormats
2223
{
@@ -30,7 +31,15 @@ internal sealed class AutoItEditorCommentClassifierFormat : ClassificationFormat
3031
public AutoItEditorCommentClassifierFormat()
3132
{
3233
this.DisplayName = "AutoItEditorCommentClassifier"; // Human readable version of the name
33-
this.ForegroundColor = Color.FromRgb(87, 166, 74);
34+
var color = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundBrushKey);
35+
if(color.R == 37 && color.G == 37 && color.B == 38)
36+
{
37+
this.ForegroundColor = Color.FromRgb(87, 166, 74); // Dark Theme
38+
}
39+
else
40+
{
41+
this.ForegroundColor = Color.FromRgb(0, 128, 0); // Other Themes
42+
}
3443
}
3544
}
3645
}

AutoItSyntaxHighlight/ClassificationFormats/AutoItEditorFunctionsClassifierFormat.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515
//
16+
using Microsoft.VisualStudio.PlatformUI;
1617
using Microsoft.VisualStudio.Text.Classification;
1718
using Microsoft.VisualStudio.Utilities;
1819
using System.ComponentModel.Composition;
@@ -30,7 +31,15 @@ internal sealed class AutoItEditorFunctionsClassifierFormat : ClassificationForm
3031
public AutoItEditorFunctionsClassifierFormat()
3132
{
3233
this.DisplayName = "AutoItEditorFunctionsClassifier"; // Human readable version of the name
33-
this.ForegroundColor = Color.FromRgb(78, 201, 176);
34+
var color = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundBrushKey);
35+
if (color.R == 37 && color.G == 37 && color.B == 38)
36+
{
37+
this.ForegroundColor = Color.FromRgb(78, 201, 176); // Dark Theme
38+
}
39+
else
40+
{
41+
this.ForegroundColor = Color.FromRgb(42, 143, 186); // Other Themes
42+
}
3443
}
3544
}
3645
}

AutoItSyntaxHighlight/ClassificationFormats/AutoItEditorKeywordClassifierFormat.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515
//
16+
using Microsoft.VisualStudio.PlatformUI;
1617
using Microsoft.VisualStudio.Text.Classification;
1718
using Microsoft.VisualStudio.Utilities;
1819
using System.ComponentModel.Composition;
@@ -30,7 +31,15 @@ internal sealed class AutoItEditorKeywordClassifierFormat : ClassificationFormat
3031
public AutoItEditorKeywordClassifierFormat()
3132
{
3233
this.DisplayName = "AutoItEditorKeywordClassifier"; // Human readable version of the name
33-
this.ForegroundColor = Color.FromRgb(86, 156, 214);
34+
var color = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundBrushKey);
35+
if (color.R == 37 && color.G == 37 && color.B == 38)
36+
{
37+
this.ForegroundColor = Color.FromRgb(86, 156, 214); // Dark Theme
38+
}
39+
else
40+
{
41+
this.ForegroundColor = Color.FromRgb(0, 0, 255); // Other Themes
42+
}
3443
}
3544
}
3645
}

AutoItSyntaxHighlight/ClassificationFormats/AutoItEditorStringClassifierFormat.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515
//
16+
using Microsoft.VisualStudio.PlatformUI;
1617
using Microsoft.VisualStudio.Text.Classification;
1718
using Microsoft.VisualStudio.Utilities;
1819
using System.ComponentModel.Composition;
@@ -30,7 +31,15 @@ internal sealed class AutoItEditorStringClassifierFormat : ClassificationFormatD
3031
public AutoItEditorStringClassifierFormat()
3132
{
3233
this.DisplayName = "AutoItEditorStringClassifier"; // Human readable version of the name
33-
this.ForegroundColor = Color.FromRgb(214, 157, 133);
34+
var color = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundBrushKey);
35+
if (color.R == 37 && color.G == 37 && color.B == 38)
36+
{
37+
this.ForegroundColor = Color.FromRgb(214, 157, 133); // Dark Theme
38+
}
39+
else
40+
{
41+
this.ForegroundColor = Color.FromRgb(163, 21, 21); // Other Themes
42+
}
3443
}
3544
}
3645
}

0 commit comments

Comments
 (0)