From 8d59f2b8cc2a1d55e873cf7b6bc7ac319645dea5 Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Thu, 6 Apr 2023 20:29:50 +0200 Subject: [PATCH 1/4] Add theme colors for current line highlight --- ILSpy/TextView/DecompilerTextView.cs | 2 ++ ILSpy/Themes/Base.Dark.xaml | 2 ++ ILSpy/Themes/Base.Light.xaml | 4 +++- ILSpy/Themes/ResourceKeys.cs | 2 ++ ILSpy/Themes/Theme.Dark.xaml | 2 ++ ILSpy/Themes/Theme.Light.xaml | 2 ++ ILSpy/Themes/Theme.RSharpDark.xaml | 4 +++- ILSpy/Themes/Theme.RSharpLight.xaml | 4 +++- ILSpy/Themes/Theme.VSCodeDarkPlus.xaml | 2 ++ ILSpy/Themes/Theme.VSCodeLightPlus.xaml | 2 ++ 10 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ILSpy/TextView/DecompilerTextView.cs b/ILSpy/TextView/DecompilerTextView.cs index b7e5f32115..fc8af11dfd 100644 --- a/ILSpy/TextView/DecompilerTextView.cs +++ b/ILSpy/TextView/DecompilerTextView.cs @@ -143,6 +143,8 @@ public DecompilerTextView() ContextMenuProvider.Add(this); textEditor.TextArea.TextView.SetResourceReference(ICSharpCode.AvalonEdit.Rendering.TextView.LinkTextForegroundBrushProperty, ResourceKeys.LinkTextForegroundBrush); + textEditor.TextArea.TextView.SetResourceReference(ICSharpCode.AvalonEdit.Rendering.TextView.CurrentLineBackgroundProperty, ResourceKeys.CurrentLineBackgroundBrush); + textEditor.TextArea.TextView.SetResourceReference(ICSharpCode.AvalonEdit.Rendering.TextView.CurrentLineBorderProperty, ResourceKeys.CurrentLineBorderPen); this.DataContextChanged += DecompilerTextView_DataContextChanged; } diff --git a/ILSpy/Themes/Base.Dark.xaml b/ILSpy/Themes/Base.Dark.xaml index 4005dec0a2..d4dfd6039f 100644 --- a/ILSpy/Themes/Base.Dark.xaml +++ b/ILSpy/Themes/Base.Dark.xaml @@ -9,6 +9,8 @@ + + #333337 #464646 diff --git a/ILSpy/Themes/Base.Light.xaml b/ILSpy/Themes/Base.Light.xaml index 8e7e5076bd..243fb45855 100644 --- a/ILSpy/Themes/Base.Light.xaml +++ b/ILSpy/Themes/Base.Light.xaml @@ -8,7 +8,9 @@ - LightGreen + + + #FCFCFC #D8D8E0 diff --git a/ILSpy/Themes/ResourceKeys.cs b/ILSpy/Themes/ResourceKeys.cs index 1d78f24dcb..7eae534dd2 100644 --- a/ILSpy/Themes/ResourceKeys.cs +++ b/ILSpy/Themes/ResourceKeys.cs @@ -30,6 +30,8 @@ public static class ResourceKeys public static ResourceKey LinkTextForegroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(LinkTextForegroundBrush)); public static ResourceKey BracketHighlightBackgroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(BracketHighlightBackgroundBrush)); public static ResourceKey BracketHighlightBorderPen = new ComponentResourceKey(typeof(ResourceKeys), nameof(BracketHighlightBorderPen)); + public static ResourceKey CurrentLineBackgroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(CurrentLineBackgroundBrush)); + public static ResourceKey CurrentLineBorderPen = new ComponentResourceKey(typeof(ResourceKeys), nameof(CurrentLineBorderPen)); public static ResourceKey ThemeAwareButtonEffect = new ComponentResourceKey(typeof(ResourceKeys), nameof(ThemeAwareButtonEffect)); } } diff --git a/ILSpy/Themes/Theme.Dark.xaml b/ILSpy/Themes/Theme.Dark.xaml index 76d3abfbb7..f2f0ee2f46 100644 --- a/ILSpy/Themes/Theme.Dark.xaml +++ b/ILSpy/Themes/Theme.Dark.xaml @@ -8,6 +8,8 @@ + + diff --git a/ILSpy/Themes/Theme.Light.xaml b/ILSpy/Themes/Theme.Light.xaml index ca08971e2c..8fd7113829 100644 --- a/ILSpy/Themes/Theme.Light.xaml +++ b/ILSpy/Themes/Theme.Light.xaml @@ -8,6 +8,8 @@ + + diff --git a/ILSpy/Themes/Theme.RSharpDark.xaml b/ILSpy/Themes/Theme.RSharpDark.xaml index 62bfddf038..778a5e3857 100644 --- a/ILSpy/Themes/Theme.RSharpDark.xaml +++ b/ILSpy/Themes/Theme.RSharpDark.xaml @@ -9,7 +9,9 @@ - #995A23 + + + #483D8B #800000 diff --git a/ILSpy/Themes/Theme.RSharpLight.xaml b/ILSpy/Themes/Theme.RSharpLight.xaml index 8eb28d77c9..7a0adab3e8 100644 --- a/ILSpy/Themes/Theme.RSharpLight.xaml +++ b/ILSpy/Themes/Theme.RSharpLight.xaml @@ -9,7 +9,9 @@ - #F6B94D + + + #87CEFA #FFB6C1 diff --git a/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml b/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml index 7a94d4fab9..124dd78e31 100644 --- a/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml +++ b/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml @@ -15,6 +15,8 @@ + + #264F78 #343A40 diff --git a/ILSpy/Themes/Theme.VSCodeLightPlus.xaml b/ILSpy/Themes/Theme.VSCodeLightPlus.xaml index 2ab0d1000f..5d3a4ccc02 100644 --- a/ILSpy/Themes/Theme.VSCodeLightPlus.xaml +++ b/ILSpy/Themes/Theme.VSCodeLightPlus.xaml @@ -15,6 +15,8 @@ + + #ADD6FF #D6EAFF From 353d63a022f2ddb25739212e0486f9a59f8e7d27 Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Thu, 6 Apr 2023 20:41:04 +0200 Subject: [PATCH 2/4] Add theme colors for line numbers --- ILSpy/TextView/DecompilerTextView.xaml | 1 + ILSpy/Themes/Base.Dark.xaml | 1 + ILSpy/Themes/Base.Light.xaml | 1 + ILSpy/Themes/ResourceKeys.cs | 1 + ILSpy/Themes/Theme.Dark.xaml | 1 + ILSpy/Themes/Theme.Light.xaml | 1 + ILSpy/Themes/Theme.RSharpDark.xaml | 1 + ILSpy/Themes/Theme.RSharpLight.xaml | 1 + ILSpy/Themes/Theme.VSCodeDarkPlus.xaml | 1 + ILSpy/Themes/Theme.VSCodeLightPlus.xaml | 1 + 10 files changed, 10 insertions(+) diff --git a/ILSpy/TextView/DecompilerTextView.xaml b/ILSpy/TextView/DecompilerTextView.xaml index ef4da7afea..42786e3968 100644 --- a/ILSpy/TextView/DecompilerTextView.xaml +++ b/ILSpy/TextView/DecompilerTextView.xaml @@ -34,6 +34,7 @@ + diff --git a/ILSpy/Themes/Base.Light.xaml b/ILSpy/Themes/Base.Light.xaml index 243fb45855..b576c42202 100644 --- a/ILSpy/Themes/Base.Light.xaml +++ b/ILSpy/Themes/Base.Light.xaml @@ -9,6 +9,7 @@ + diff --git a/ILSpy/Themes/ResourceKeys.cs b/ILSpy/Themes/ResourceKeys.cs index 7eae534dd2..8dd5d9abe0 100644 --- a/ILSpy/Themes/ResourceKeys.cs +++ b/ILSpy/Themes/ResourceKeys.cs @@ -30,6 +30,7 @@ public static class ResourceKeys public static ResourceKey LinkTextForegroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(LinkTextForegroundBrush)); public static ResourceKey BracketHighlightBackgroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(BracketHighlightBackgroundBrush)); public static ResourceKey BracketHighlightBorderPen = new ComponentResourceKey(typeof(ResourceKeys), nameof(BracketHighlightBorderPen)); + public static ResourceKey LineNumbersForegroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(LineNumbersForegroundBrush)); public static ResourceKey CurrentLineBackgroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(CurrentLineBackgroundBrush)); public static ResourceKey CurrentLineBorderPen = new ComponentResourceKey(typeof(ResourceKeys), nameof(CurrentLineBorderPen)); public static ResourceKey ThemeAwareButtonEffect = new ComponentResourceKey(typeof(ResourceKeys), nameof(ThemeAwareButtonEffect)); diff --git a/ILSpy/Themes/Theme.Dark.xaml b/ILSpy/Themes/Theme.Dark.xaml index f2f0ee2f46..41441900e0 100644 --- a/ILSpy/Themes/Theme.Dark.xaml +++ b/ILSpy/Themes/Theme.Dark.xaml @@ -8,6 +8,7 @@ + diff --git a/ILSpy/Themes/Theme.Light.xaml b/ILSpy/Themes/Theme.Light.xaml index 8fd7113829..b1818ea23f 100644 --- a/ILSpy/Themes/Theme.Light.xaml +++ b/ILSpy/Themes/Theme.Light.xaml @@ -8,6 +8,7 @@ + diff --git a/ILSpy/Themes/Theme.RSharpDark.xaml b/ILSpy/Themes/Theme.RSharpDark.xaml index 778a5e3857..bcd9672adc 100644 --- a/ILSpy/Themes/Theme.RSharpDark.xaml +++ b/ILSpy/Themes/Theme.RSharpDark.xaml @@ -10,6 +10,7 @@ + diff --git a/ILSpy/Themes/Theme.RSharpLight.xaml b/ILSpy/Themes/Theme.RSharpLight.xaml index 7a0adab3e8..312919f2a1 100644 --- a/ILSpy/Themes/Theme.RSharpLight.xaml +++ b/ILSpy/Themes/Theme.RSharpLight.xaml @@ -10,6 +10,7 @@ + diff --git a/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml b/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml index 124dd78e31..ef7aa20b1c 100644 --- a/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml +++ b/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml @@ -15,6 +15,7 @@ + diff --git a/ILSpy/Themes/Theme.VSCodeLightPlus.xaml b/ILSpy/Themes/Theme.VSCodeLightPlus.xaml index 5d3a4ccc02..4026ac36c4 100644 --- a/ILSpy/Themes/Theme.VSCodeLightPlus.xaml +++ b/ILSpy/Themes/Theme.VSCodeLightPlus.xaml @@ -15,6 +15,7 @@ + From f5c49bf42edba14d19a59efaa655e1978a60211b Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Thu, 6 Apr 2023 20:52:58 +0200 Subject: [PATCH 3/4] Add theme colors for matching brackets --- ILSpy/Themes/Base.Dark.xaml | 5 ++--- ILSpy/Themes/Base.Light.xaml | 5 ++--- ILSpy/Themes/Theme.Dark.xaml | 2 ++ ILSpy/Themes/Theme.Light.xaml | 2 ++ ILSpy/Themes/Theme.RSharpDark.xaml | 2 ++ ILSpy/Themes/Theme.RSharpLight.xaml | 2 ++ ILSpy/Themes/Theme.VSCodeDarkPlus.xaml | 2 ++ ILSpy/Themes/Theme.VSCodeLightPlus.xaml | 2 ++ 8 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ILSpy/Themes/Base.Dark.xaml b/ILSpy/Themes/Base.Dark.xaml index 0247152209..aa388d9908 100644 --- a/ILSpy/Themes/Base.Dark.xaml +++ b/ILSpy/Themes/Base.Dark.xaml @@ -12,6 +12,8 @@ + + #333337 #464646 @@ -36,9 +38,6 @@ #434346 #808080 - - - diff --git a/ILSpy/Themes/Base.Light.xaml b/ILSpy/Themes/Base.Light.xaml index b576c42202..c2138b5a45 100644 --- a/ILSpy/Themes/Base.Light.xaml +++ b/ILSpy/Themes/Base.Light.xaml @@ -12,6 +12,8 @@ + + #FCFCFC #D8D8E0 @@ -34,9 +36,6 @@ #CCCEDB #808080 - - - diff --git a/ILSpy/Themes/Theme.Dark.xaml b/ILSpy/Themes/Theme.Dark.xaml index 41441900e0..e087d39f86 100644 --- a/ILSpy/Themes/Theme.Dark.xaml +++ b/ILSpy/Themes/Theme.Dark.xaml @@ -11,6 +11,8 @@ + + diff --git a/ILSpy/Themes/Theme.Light.xaml b/ILSpy/Themes/Theme.Light.xaml index b1818ea23f..f085856d8d 100644 --- a/ILSpy/Themes/Theme.Light.xaml +++ b/ILSpy/Themes/Theme.Light.xaml @@ -11,6 +11,8 @@ + + diff --git a/ILSpy/Themes/Theme.RSharpDark.xaml b/ILSpy/Themes/Theme.RSharpDark.xaml index bcd9672adc..ca47f40877 100644 --- a/ILSpy/Themes/Theme.RSharpDark.xaml +++ b/ILSpy/Themes/Theme.RSharpDark.xaml @@ -13,6 +13,8 @@ + + #483D8B #800000 diff --git a/ILSpy/Themes/Theme.RSharpLight.xaml b/ILSpy/Themes/Theme.RSharpLight.xaml index 312919f2a1..a41da7d324 100644 --- a/ILSpy/Themes/Theme.RSharpLight.xaml +++ b/ILSpy/Themes/Theme.RSharpLight.xaml @@ -13,6 +13,8 @@ + + #87CEFA #FFB6C1 diff --git a/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml b/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml index ef7aa20b1c..402b4327a6 100644 --- a/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml +++ b/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml @@ -18,6 +18,8 @@ + + #264F78 #343A40 diff --git a/ILSpy/Themes/Theme.VSCodeLightPlus.xaml b/ILSpy/Themes/Theme.VSCodeLightPlus.xaml index 4026ac36c4..480892348d 100644 --- a/ILSpy/Themes/Theme.VSCodeLightPlus.xaml +++ b/ILSpy/Themes/Theme.VSCodeLightPlus.xaml @@ -18,6 +18,8 @@ + + #ADD6FF #D6EAFF From 1106a6251a38cd7efc035a362caf794d2a6eaa04 Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Thu, 6 Apr 2023 21:27:33 +0200 Subject: [PATCH 4/4] Align highlighted brackets border to whole pixels --- ILSpy/TextView/BracketHighlightRenderer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ILSpy/TextView/BracketHighlightRenderer.cs b/ILSpy/TextView/BracketHighlightRenderer.cs index 9a61bce318..4b958d407a 100644 --- a/ILSpy/TextView/BracketHighlightRenderer.cs +++ b/ILSpy/TextView/BracketHighlightRenderer.cs @@ -114,6 +114,8 @@ public void Draw(ICSharpCode.AvalonEdit.Rendering.TextView textView, DrawingCont BackgroundGeometryBuilder builder = new BackgroundGeometryBuilder(); builder.CornerRadius = 1; + builder.AlignToWholePixels = true; + builder.BorderThickness = borderPen?.Thickness ?? 0; builder.AddSegment(textView, new TextSegment() { StartOffset = result.OpeningBracketOffset, Length = result.OpeningBracketLength }); builder.CloseFigure(); // prevent connecting the two segments