From c5ed7c1ac8311efe5e22f2431581e1da95aeec08 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Tue, 26 Oct 2021 19:28:52 +0200 Subject: [PATCH] Fix #2520: The matched pairs are hardly visible in the dark theme --- ILSpy/TextView/BracketHighlightRenderer.cs | 9 ++++----- ILSpy/Themes/DarkTheme.xaml | 3 +++ ILSpy/Themes/LightTheme.xaml | 6 +++++- ILSpy/Themes/ResourceKeys.cs | 2 ++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ILSpy/TextView/BracketHighlightRenderer.cs b/ILSpy/TextView/BracketHighlightRenderer.cs index cdccc0e60..9a61bce31 100644 --- a/ILSpy/TextView/BracketHighlightRenderer.cs +++ b/ILSpy/TextView/BracketHighlightRenderer.cs @@ -81,6 +81,8 @@ namespace ICSharpCode.ILSpy.TextView if (this.result != result) { this.result = result; + this.borderPen = (Pen)textView.FindResource(Themes.ResourceKeys.BracketHighlightBorderPen); + this.backgroundBrush = (SolidColorBrush)textView.FindResource(Themes.ResourceKeys.BracketHighlightBackgroundBrush); textView.InvalidateLayer(this.Layer); } } @@ -90,11 +92,8 @@ namespace ICSharpCode.ILSpy.TextView if (textView == null) throw new ArgumentNullException("textView"); - this.borderPen = new Pen(new SolidColorBrush(Color.FromArgb(52, 0, 0, 255)), 1); - this.borderPen.Freeze(); - - this.backgroundBrush = new SolidColorBrush(Color.FromArgb(22, 0, 0, 255)); - this.backgroundBrush.Freeze(); + this.borderPen = (Pen)textView.FindResource(Themes.ResourceKeys.BracketHighlightBorderPen); + this.backgroundBrush = (SolidColorBrush)textView.FindResource(Themes.ResourceKeys.BracketHighlightBackgroundBrush); this.textView = textView; diff --git a/ILSpy/Themes/DarkTheme.xaml b/ILSpy/Themes/DarkTheme.xaml index ceae6bf7f..94d96ab0b 100644 --- a/ILSpy/Themes/DarkTheme.xaml +++ b/ILSpy/Themes/DarkTheme.xaml @@ -29,6 +29,9 @@ #434346 #808080 + + + diff --git a/ILSpy/Themes/LightTheme.xaml b/ILSpy/Themes/LightTheme.xaml index 71bfe6e49..e9c01f691 100644 --- a/ILSpy/Themes/LightTheme.xaml +++ b/ILSpy/Themes/LightTheme.xaml @@ -1,6 +1,7 @@  + xmlns:styles="urn:TomsToolbox.Wpf.Styles" + xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"> @@ -26,6 +27,9 @@ #CCCEDB #808080 + + + diff --git a/ILSpy/Themes/ResourceKeys.cs b/ILSpy/Themes/ResourceKeys.cs index d3e9b56d3..95a98ac11 100644 --- a/ILSpy/Themes/ResourceKeys.cs +++ b/ILSpy/Themes/ResourceKeys.cs @@ -7,5 +7,7 @@ namespace ICSharpCode.ILSpy.Themes public static ResourceKey TextMarkerBackgroundColor = new ComponentResourceKey(typeof(ResourceKeys), "TextMarkerBackgroundColor"); public static ResourceKey TextMarkerDefinitionBackgroundColor = new ComponentResourceKey(typeof(ResourceKeys), "TextMarkerDefinitionBackgroundColor"); public static ResourceKey LinkTextForegroundBrush = new ComponentResourceKey(typeof(ResourceKeys), "LinkTextForegroundBrush"); + public static ResourceKey BracketHighlightBackgroundBrush = new ComponentResourceKey(typeof(ResourceKeys), "BracketHighlightBackgroundBrush"); + public static ResourceKey BracketHighlightBorderPen = new ComponentResourceKey(typeof(ResourceKeys), "BracketHighlightBorderPen"); } }