From bca06d782868f52e39d06c3c3c8c1d1e3fcb8cae Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Sat, 16 Dec 2023 19:56:20 +0100 Subject: [PATCH] Adjust colors of AvalonEdit built-in highlightings for dark themes --- ILSpy/TextView/DecompilerTextEditor.cs | 13 +++ ILSpy/TextView/DecompilerTextView.xaml | 55 +++++---- .../ThemeAwareHighlightingColorizer.cs | 105 ++++++++++++++++++ ILSpy/Themes/ThemeManager.cs | 15 ++- 4 files changed, 159 insertions(+), 29 deletions(-) create mode 100644 ILSpy/TextView/DecompilerTextEditor.cs create mode 100644 ILSpy/TextView/ThemeAwareHighlightingColorizer.cs diff --git a/ILSpy/TextView/DecompilerTextEditor.cs b/ILSpy/TextView/DecompilerTextEditor.cs new file mode 100644 index 0000000000..f258794496 --- /dev/null +++ b/ILSpy/TextView/DecompilerTextEditor.cs @@ -0,0 +1,13 @@ +using ICSharpCode.AvalonEdit; +using ICSharpCode.AvalonEdit.Highlighting; +using ICSharpCode.AvalonEdit.Rendering; + +namespace ICSharpCode.ILSpy.TextView; + +public class DecompilerTextEditor : TextEditor +{ + protected override IVisualLineTransformer CreateColorizer(IHighlightingDefinition highlightingDefinition) + { + return new ThemeAwareHighlightingColorizer(highlightingDefinition); + } +} diff --git a/ILSpy/TextView/DecompilerTextView.xaml b/ILSpy/TextView/DecompilerTextView.xaml index 42786e3968..2230cae602 100644 --- a/ILSpy/TextView/DecompilerTextView.xaml +++ b/ILSpy/TextView/DecompilerTextView.xaml @@ -1,17 +1,16 @@  + xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties" + xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls" + xmlns:local="clr-namespace:ICSharpCode.ILSpy.TextView" + xmlns:editing="clr-namespace:ICSharpCode.AvalonEdit.Editing;assembly=ICSharpCode.AvalonEdit" + xmlns:folding="clr-namespace:ICSharpCode.AvalonEdit.Folding;assembly=ICSharpCode.AvalonEdit" + xmlns:styles="urn:TomsToolbox.Wpf.Styles" + xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"> - + - - - + + + + Value="True"> + Property="HorizontalScrollBarVisibility" + Value="Disabled" /> - - + + @@ -102,10 +101,10 @@ - + -