Browse Source

Merge pull request #2906 from ltrzesniewski/themes

pull/2934/head
Siegfried Pammer 2 years ago committed by GitHub
parent
commit
b91355d171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ICSharpCode.Decompiler/Output/TextTokenWriter.cs
  2. 5
      ILSpy/ILSpy.csproj
  3. BIN
      ILSpy/Images/DarkMode.png
  4. 129
      ILSpy/Languages/CSharpHighlightingTokenWriter.cs
  5. 14
      ILSpy/MainWindow.xaml
  6. 2
      ILSpy/MainWindow.xaml.cs
  7. 19
      ILSpy/Properties/Resources.Designer.cs
  8. 6
      ILSpy/Properties/Resources.resx
  9. 3
      ILSpy/Properties/Resources.zh-Hans.resx
  10. 10
      ILSpy/SessionSettings.cs
  11. 1211
      ILSpy/TextView/Asm-Mode-Dark.xshd
  12. 6
      ILSpy/TextView/Asm-Mode.xshd
  13. 149
      ILSpy/TextView/CSharp-Mode-Dark.xshd
  14. 10
      ILSpy/TextView/CSharp-Mode.xshd
  15. 18
      ILSpy/TextView/DecompilerTextView.cs
  16. 7
      ILSpy/TextView/DecompilerTextView.xaml
  17. 536
      ILSpy/TextView/ILAsm-Mode-Dark.xshd
  18. 6
      ILSpy/TextView/ILAsm-Mode.xshd
  19. 63
      ILSpy/TextView/XML-Mode-Dark.xshd
  20. 8
      ILSpy/Themes/Base.Dark.xaml
  21. 7
      ILSpy/Themes/Base.Light.xaml
  22. 14
      ILSpy/Themes/ResourceKeys.cs
  23. 32
      ILSpy/Themes/SyntaxColor.cs
  24. 91
      ILSpy/Themes/Theme.Dark.xaml
  25. 91
      ILSpy/Themes/Theme.Light.xaml
  26. 96
      ILSpy/Themes/Theme.RSharpDark.xaml
  27. 96
      ILSpy/Themes/Theme.RSharpLight.xaml
  28. 101
      ILSpy/Themes/Theme.VSCodeDarkPlus.xaml
  29. 101
      ILSpy/Themes/Theme.VSCodeLightPlus.xaml
  30. 84
      ILSpy/Themes/ThemeManager.cs

2
ICSharpCode.Decompiler/Output/TextTokenWriter.cs

@ -457,7 +457,7 @@ namespace ICSharpCode.Decompiler @@ -457,7 +457,7 @@ namespace ICSharpCode.Decompiler
{
if (node is EntityDeclaration && !(node.Parent is LocalFunctionDeclarationStatement))
return true;
if (node is VariableInitializer && node.Parent is FieldDeclaration)
if (node is VariableInitializer && node.Parent is FieldDeclaration or EventDeclaration)
{
node = node.Parent;
return true;

5
ILSpy/ILSpy.csproj

@ -64,16 +64,11 @@ @@ -64,16 +64,11 @@
<Link>license.txt</Link>
</EmbeddedResource>
<Resource Include="Images\NuGet.png" />
<Resource Include="Images\DarkMode.png" />
<Resource Include="Images\ILSpy.ico" />
<EmbeddedResource Include="TextView\CSharp-Mode.xshd" />
<EmbeddedResource Include="TextView\ILAsm-Mode.xshd" />
<EmbeddedResource Include="TextView\Asm-Mode.xshd" />
<EmbeddedResource Include="TextView\XML-Mode.xshd" />
<EmbeddedResource Include="TextView\CSharp-Mode-Dark.xshd" />
<EmbeddedResource Include="TextView\ILAsm-Mode-Dark.xshd" />
<EmbeddedResource Include="TextView\Asm-Mode-Dark.xshd" />
<EmbeddedResource Include="TextView\XML-Mode-Dark.xshd" />
<None Remove="Properties\launchSettings.json" />
</ItemGroup>

BIN
ILSpy/Images/DarkMode.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

129
ILSpy/Languages/CSharpHighlightingTokenWriter.cs

@ -23,6 +23,7 @@ using ICSharpCode.AvalonEdit.Highlighting; @@ -23,6 +23,7 @@ using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.CSharp.OutputVisitor;
using ICSharpCode.Decompiler.CSharp.Syntax;
using ICSharpCode.Decompiler.IL;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpyX.Extensions;
@ -55,9 +56,15 @@ namespace ICSharpCode.ILSpy @@ -55,9 +56,15 @@ namespace ICSharpCode.ILSpy
HighlightingColor methodCallColor;
HighlightingColor methodDeclarationColor;
HighlightingColor fieldDeclarationColor;
HighlightingColor fieldAccessColor;
HighlightingColor propertyDeclarationColor;
HighlightingColor propertyAccessColor;
HighlightingColor eventDeclarationColor;
HighlightingColor eventAccessColor;
HighlightingColor variableColor;
HighlightingColor parameterColor;
HighlightingColor valueKeywordColor;
HighlightingColor thisKeywordColor;
@ -95,12 +102,16 @@ namespace ICSharpCode.ILSpy @@ -95,12 +102,16 @@ namespace ICSharpCode.ILSpy
this.enumerationTypeColor = highlighting.GetNamedColor("EnumTypes");
this.typeParameterTypeColor = highlighting.GetNamedColor("TypeParameters");
this.delegateTypeColor = highlighting.GetNamedColor("DelegateTypes");
this.methodDeclarationColor = this.methodCallColor = highlighting.GetNamedColor("MethodCall");
//this.eventDeclarationColor = this.eventAccessColor = defaultTextColor;
//this.propertyDeclarationColor = this.propertyAccessColor = defaultTextColor;
this.fieldDeclarationColor = this.fieldAccessColor = highlighting.GetNamedColor("FieldAccess");
//this.variableDeclarationColor = this.variableAccessColor = defaultTextColor;
//this.parameterDeclarationColor = this.parameterAccessColor = defaultTextColor;
this.methodDeclarationColor = highlighting.GetNamedColor("MethodDeclaration");
this.methodCallColor = highlighting.GetNamedColor("MethodCall");
this.fieldDeclarationColor = highlighting.GetNamedColor("FieldDeclaration");
this.fieldAccessColor = highlighting.GetNamedColor("FieldAccess");
this.propertyDeclarationColor = highlighting.GetNamedColor("PropertyDeclaration");
this.propertyAccessColor = highlighting.GetNamedColor("PropertyAccess");
this.eventDeclarationColor = highlighting.GetNamedColor("EventDeclaration");
this.eventAccessColor = highlighting.GetNamedColor("EventAccess");
this.variableColor = highlighting.GetNamedColor("Variable");
this.parameterColor = highlighting.GetNamedColor("Parameter");
this.valueKeywordColor = highlighting.GetNamedColor("NullOrValueKeywords");
this.thisKeywordColor = highlighting.GetNamedColor("ThisOrBaseReference");
this.trueKeywordColor = highlighting.GetNamedColor("TrueFalse");
@ -338,13 +349,25 @@ namespace ICSharpCode.ILSpy @@ -338,13 +349,25 @@ namespace ICSharpCode.ILSpy
public override void WriteIdentifier(Identifier identifier)
{
HighlightingColor color = null;
if (identifier.Name == "value"
&& identifier.Parent?.GetResolveResult() is ILVariableResolveResult rr
&& rr.Variable.Kind == Decompiler.IL.VariableKind.Parameter
&& identifier.Ancestors.OfType<Accessor>().FirstOrDefault() is Accessor accessor
&& accessor.Role != PropertyDeclaration.GetterRole)
if (identifier.Parent?.GetResolveResult() is ILVariableResolveResult rr)
{
color = valueKeywordColor;
if (rr.Variable.Kind == VariableKind.Parameter)
{
if (identifier.Name == "value"
&& identifier.Ancestors.OfType<Accessor>().FirstOrDefault() is { } accessor
&& accessor.Role != PropertyDeclaration.GetterRole)
{
color = valueKeywordColor;
}
else
{
color = parameterColor;
}
}
else
{
color = variableColor;
}
}
if (identifier.Parent is AstType)
{
@ -361,60 +384,40 @@ namespace ICSharpCode.ILSpy @@ -361,60 +384,40 @@ namespace ICSharpCode.ILSpy
switch (GetCurrentDefinition())
{
case ITypeDefinition t:
switch (t.Kind)
{
case TypeKind.Delegate:
color = delegateTypeColor;
break;
case TypeKind.Class:
color = referenceTypeColor;
break;
case TypeKind.Interface:
color = interfaceTypeColor;
break;
case TypeKind.Enum:
color = enumerationTypeColor;
break;
case TypeKind.Struct:
color = valueTypeColor;
break;
}
ApplyTypeColor(t, ref color);
break;
case IMethod m:
case IMethod:
color = methodDeclarationColor;
break;
case IField f:
case IField:
color = fieldDeclarationColor;
break;
case IProperty:
color = propertyDeclarationColor;
break;
case IEvent:
color = eventDeclarationColor;
break;
}
switch (GetCurrentMemberReference())
{
case IType t:
switch (t.Kind)
{
case TypeKind.Delegate:
color = delegateTypeColor;
break;
case TypeKind.Class:
color = referenceTypeColor;
break;
case TypeKind.Interface:
color = interfaceTypeColor;
break;
case TypeKind.Enum:
color = enumerationTypeColor;
break;
case TypeKind.Struct:
color = valueTypeColor;
break;
}
ApplyTypeColor(t, ref color);
break;
case IMethod m:
color = methodCallColor;
if (m.IsConstructor)
ApplyTypeColor(m.DeclaringType, ref color);
break;
case IField f:
case IField:
color = fieldAccessColor;
break;
case IProperty:
color = propertyAccessColor;
break;
case IEvent:
color = eventAccessColor;
break;
}
if (color != null)
{
@ -427,6 +430,28 @@ namespace ICSharpCode.ILSpy @@ -427,6 +430,28 @@ namespace ICSharpCode.ILSpy
}
}
void ApplyTypeColor(IType type, ref HighlightingColor color)
{
switch (type?.Kind)
{
case TypeKind.Delegate:
color = delegateTypeColor;
break;
case TypeKind.Class:
color = referenceTypeColor;
break;
case TypeKind.Interface:
color = interfaceTypeColor;
break;
case TypeKind.Enum:
color = enumerationTypeColor;
break;
case TypeKind.Struct:
color = valueTypeColor;
break;
}
}
public override void WritePrimitiveValue(object value, Decompiler.CSharp.Syntax.LiteralFormat format)
{
HighlightingColor color = null;

14
ILSpy/MainWindow.xaml

@ -92,8 +92,6 @@ @@ -92,8 +92,6 @@
<ContentPresenter Content="{Binding Content}" />
</DataTemplate>
<styles:InvertGrayEffect x:Key="InvertGrayEffect" />
<controls:CultureSelectionConverter x:Key="cultureSelectionConverter" />
</Window.Resources>
@ -164,17 +162,13 @@ @@ -164,17 +162,13 @@
</Style.Triggers>
</Style>
<Style TargetType="{x:Type Image}" x:Key="DarkModeAwareImageStyle">
<Setter Property="Effect" Value="{DynamicResource {x:Static themes:ResourceKeys.ThemeAwareButtonEffect}}" />
<Style.Triggers>
<DataTrigger
Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ButtonBase}, AncestorLevel=1}, Path=IsEnabled}"
Value="False">
<Setter Property="Opacity" Value="0.30" />
</DataTrigger>
<DataTrigger
Binding="{Binding SessionSettings.IsDarkMode}"
Value="True">
<Setter Property="Effect" Value="{StaticResource InvertGrayEffect}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ToolBar.Resources>
@ -209,9 +203,9 @@ @@ -209,9 +203,9 @@
ItemsSource="{Binding SelectedItem.LanguageVersions, ElementName=languageComboBox, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding Workspace.ActiveTabPage.FilterSettings.LanguageVersion, UpdateSourceTrigger=PropertyChanged}"/>
<Separator />
<CheckBox IsChecked="{Binding SessionSettings.IsDarkMode}" ToolTip="{x:Static properties:Resources.DarkMode}">
<Image Source="Images/DarkMode.png" Stretch="None" Style="{StaticResource DarkModeAwareImageStyle}"/>
</CheckBox>
<ComboBox Width="100" MaxDropDownHeight="Auto" ToolTip="{x:Static properties:Resources.Theme}"
ItemsSource="{x:Static themes:ThemeManager.AllThemes}"
SelectedItem="{Binding SessionSettings.Theme}"/>
</ToolBar>
<Border DockPanel.Dock="Top" BorderBrush="Black" BorderThickness="1" Name="updatePanel" Visibility="Collapsed">
<DockPanel KeyboardNavigation.TabNavigation="Contained">

2
ILSpy/MainWindow.xaml.cs

@ -184,7 +184,7 @@ namespace ICSharpCode.ILSpy @@ -184,7 +184,7 @@ namespace ICSharpCode.ILSpy
case nameof(SessionSettings.ActiveAssemblyList):
ShowAssemblyList(sessionSettings.ActiveAssemblyList);
break;
case nameof(SessionSettings.IsDarkMode):
case nameof(SessionSettings.Theme):
// update syntax highlighting and force reload (AvalonEdit does not automatically refresh on highlighting change)
DecompilerTextView.RegisterHighlighting();
DecompileSelectedNodes(DockWorkspace.Instance.ActiveTabPage.GetState() as DecompilerTextViewState);

19
ILSpy/Properties/Resources.Designer.cs generated

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -567,15 +566,6 @@ namespace ICSharpCode.ILSpy.Properties { @@ -567,15 +566,6 @@ namespace ICSharpCode.ILSpy.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Dark Mode.
/// </summary>
public static string DarkMode {
get {
return ResourceManager.GetString("DarkMode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to DEBUG -- Decompile All.
/// </summary>
@ -2646,6 +2636,15 @@ namespace ICSharpCode.ILSpy.Properties { @@ -2646,6 +2636,15 @@ namespace ICSharpCode.ILSpy.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Theme.
/// </summary>
public static string Theme {
get {
return ResourceManager.GetString("Theme", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Toggle All Folding.
/// </summary>

6
ILSpy/Properties/Resources.resx

@ -222,9 +222,6 @@ Are you sure you want to continue?</value> @@ -222,9 +222,6 @@ Are you sure you want to continue?</value>
<data name="DEBUGDumpPDBAsXML" xml:space="preserve">
<value>DEBUG -- Dump PDB as XML</value>
</data>
<data name="DarkMode" xml:space="preserve">
<value>Dark Mode</value>
</data>
<data name="DebugSteps" xml:space="preserve">
<value>Debug Steps</value>
</data>
@ -907,6 +904,9 @@ Do you want to continue?</value> @@ -907,6 +904,9 @@ Do you want to continue?</value>
<data name="TabSize" xml:space="preserve">
<value>Tab size:</value>
</data>
<data name="Theme" xml:space="preserve">
<value>Theme</value>
</data>
<data name="ToggleFolding" xml:space="preserve">
<value>Toggle All Folding</value>
</data>

3
ILSpy/Properties/Resources.zh-Hans.resx

@ -222,9 +222,6 @@ @@ -222,9 +222,6 @@
<data name="DEBUGDumpPDBAsXML" xml:space="preserve">
<value>调试 -- PDB 转储为 XML</value>
</data>
<data name="DarkMode" xml:space="preserve">
<value>深色</value>
</data>
<data name="DebugSteps" xml:space="preserve">
<value>调试步骤</value>
</data>

10
ILSpy/SessionSettings.cs

@ -64,7 +64,7 @@ namespace ICSharpCode.ILSpy @@ -64,7 +64,7 @@ namespace ICSharpCode.ILSpy
this.TopPaneSplitterPosition = FromString((string)doc.Element("TopPaneSplitterPosition"), 0.3);
this.BottomPaneSplitterPosition = FromString((string)doc.Element("BottomPaneSplitterPosition"), 0.3);
this.SelectedSearchMode = FromString((string)doc.Element("SelectedSearchMode"), SearchMode.TypeAndMember);
this.IsDarkMode = FromString((string)doc.Element(nameof(IsDarkMode)), false);
this.Theme = FromString((string)doc.Element(nameof(Theme)), ThemeManager.Current.DefaultTheme);
string currentCulture = (string)doc.Element(nameof(CurrentCulture));
this.CurrentCulture = string.IsNullOrEmpty(currentCulture) ? null : currentCulture;
@ -81,10 +81,10 @@ namespace ICSharpCode.ILSpy @@ -81,10 +81,10 @@ namespace ICSharpCode.ILSpy
public FilterSettings FilterSettings { get; internal set; }
public SearchMode SelectedSearchMode { get; set; }
public bool IsDarkMode {
get => ThemeManager.Current.IsDarkMode;
public string Theme {
get => ThemeManager.Current.Theme;
set {
ThemeManager.Current.IsDarkMode = value;
ThemeManager.Current.Theme = value;
OnPropertyChanged();
}
}
@ -149,7 +149,7 @@ namespace ICSharpCode.ILSpy @@ -149,7 +149,7 @@ namespace ICSharpCode.ILSpy
doc.Add(new XElement("TopPaneSplitterPosition", ToString(this.TopPaneSplitterPosition)));
doc.Add(new XElement("BottomPaneSplitterPosition", ToString(this.BottomPaneSplitterPosition)));
doc.Add(new XElement("SelectedSearchMode", ToString(this.SelectedSearchMode)));
doc.Add(new XElement(nameof(IsDarkMode), ToString(this.IsDarkMode)));
doc.Add(new XElement(nameof(Theme), ToString(this.Theme)));
if (this.CurrentCulture != null)
{
doc.Add(new XElement(nameof(CurrentCulture), this.CurrentCulture));

1211
ILSpy/TextView/Asm-Mode-Dark.xshd

File diff suppressed because it is too large Load Diff

6
ILSpy/TextView/Asm-Mode.xshd

@ -8,7 +8,8 @@ @@ -8,7 +8,8 @@
<Color name="Registers" foreground="#8080FF" background="#EEEEEE" exampleText="nop" />
<Color name="Directives" foreground="Blue" fontWeight="bold" exampleText=".class" />
<Color name="Directive Operands" foreground="DarkBlue" fontWeight="bold" exampleText=".class" />
<Color name="Address and Bytes" exampleText="00000000003DEB40 56" />
<RuleSet ignoreCase="false">
<Keywords color="Instructions">
<Word>aaa</Word>
@ -1189,6 +1190,9 @@ @@ -1189,6 +1190,9 @@
<Span color="Comment" ruleSet="CommentMarkerSet">
<Begin>;</Begin>
</Span>
<Rule color="Address and Bytes">
^ \s* [0-9A-F]+ \s+ [0-9A-F]+
</Rule>
<Rule color="NumberLiteral">
\b(0[xXhH])?[0-9a-fA-F_`]+[h]? # hex number
|

149
ILSpy/TextView/CSharp-Mode-Dark.xshd

@ -1,149 +0,0 @@ @@ -1,149 +0,0 @@
<?xml version="1.0"?>
<SyntaxDefinition name="C#" extensions=".cs" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<!-- This is a variant of the AvalonEdit C# highlighting that has several constructs disabled.
The disabled constructs (e.g. contextual keywords) are highlighted using the CSharpLanguage.HighlightingTokenWriter instead.
-->
<!-- The named colors 'Comment' and 'String' are used in SharpDevelop to detect if a line is inside a multiline string/comment -->
<Color name="Comment" foreground="#FF57A64A" exampleText="// comment" />
<Color name="String" foreground="#FFD69D85" exampleText="string text = &quot;Hello, World!&quot;"/>
<Color name="StringInterpolation" foreground="#FFffd68f" exampleText="string text = $&quot;Hello, {name}!&quot;"/>
<Color name="Char" foreground="#FFD69D85" exampleText="char linefeed = '\n';"/>
<Color name="Preprocessor" foreground="#FF9B9B9B" exampleText="#region Title"/>
<Color name="Punctuation" foreground="White" exampleText="a(b.c);"/>
<Color name="ValueTypeKeywords" foreground="#FF00A0FF" exampleText="bool b = true;"/>
<Color name="ReferenceTypeKeywords" foreground="#FF559CD6" exampleText="object o;"/>
<Color name="NumberLiteral" foreground="#FFb5cea8" exampleText="3.1415f"/>
<Color name="ThisOrBaseReference" foreground="#FF3a6a9b" exampleText="this.Do(); base.Do();"/>
<Color name="NullOrValueKeywords" foreground="#FF559CD6" exampleText="if (value == null)"/>
<Color name="Keywords" foreground="#FFd8a0df" exampleText="if (a) {} else {}"/>
<Color name="GotoKeywords" foreground="#FFd8a0df" exampleText="continue; return null;"/>
<Color name="QueryKeywords" foreground="#FFd8a0df" exampleText="var a = from x in y select z;"/>
<Color name="ExceptionKeywords" foreground="#FFd8a0df" exampleText="try {} catch {} finally {}"/>
<Color name="CheckedKeyword" foreground="#FF559CD6" exampleText="checked {}"/>
<Color name="UnsafeKeywords" foreground="#FF559CD6" exampleText="unsafe { fixed (..) {} }"/>
<Color name="OperatorKeywords" foreground="#FFD69D85" exampleText="public static implicit operator..."/>
<Color name="ParameterModifiers" foreground="#FF559CD6" exampleText="(ref int a, params int[] b)"/>
<Color name="Modifiers" foreground="#FF559CD6" exampleText="static readonly int a;"/>
<Color name="Visibility" foreground="#FF559CD6" exampleText="public override void ToString();"/>
<Color name="NamespaceKeywords" foreground="#FF559CD6" exampleText="namespace A.B { using System; }"/>
<Color name="GetSetAddRemove" foreground="#FF559CD6" exampleText="int Prop { get; set; }"/>
<Color name="TrueFalse" foreground="#FF00A0FF" exampleText="b = false; a = true;"/>
<Color name="TypeKeywords" foreground="#FF559CD6" exampleText="if (x is int) { a = x as int; type = typeof(int); size = sizeof(int); c = new object(); }"/>
<Color name="AttributeKeywords" foreground="#FFD69D85" exampleText="[assembly: AssemblyVersion(&quot;1.0.0.*&quot;)]" />
<!-- Colors used for semantic highlighting -->
<Color name="ReferenceTypes" foreground="#569CD6" exampleText="System.#{#Uri#}# uri;"/>
<Color name="InterfaceTypes" foreground="#569CD6" exampleText="System.#{#IDisposable#}# obj;"/>
<Color name="TypeParameters" foreground="#569CD6" exampleText="class MyList&lt;#{#T#}#&gt; { }"/>
<Color name="DelegateTypes" foreground="#569CD6" exampleText="System.#{#Action#}#; action;"/>
<Color name="ValueTypes" fontWeight="bold" foreground="#569CD6" exampleText="System.#{#DateTime#}# date;"/>
<Color name="EnumTypes" fontWeight="bold" foreground="#569CD6" exampleText="System.#{#ConsoleKey#}# key;"/>
<Color name="MethodCall" foreground="#FFdcdcaa" fontWeight="bold" exampleText="o.#{#ToString#}#();"/>
<Color name="FieldAccess" fontStyle="italic" exampleText="return this.#{#name#}#;"/>
<Color name="InactiveCode" foreground="Gray" exampleText="#{#Deactivated by #if#}#"/>
<Color name="SemanticError" foreground="DarkRed" exampleText="o.#{#MissingMethod#}#()"/>
<Property name="DocCommentMarker" value="///" />
<RuleSet name="CommentMarkerSet">
<Keywords fontWeight="bold" foreground="Red">
<Word>TODO</Word>
<Word>FIXME</Word>
</Keywords>
<Keywords fontWeight="bold" foreground="#E0E000">
<Word>HACK</Word>
<Word>UNDONE</Word>
</Keywords>
</RuleSet>
<!-- This is the main ruleset. -->
<RuleSet>
<Span color="Preprocessor">
<Begin>\#</Begin>
<RuleSet name="PreprocessorSet">
<Span> <!-- preprocessor directives that allow comments -->
<Begin fontWeight="bold">
(define|undef|if|elif|else|endif|line)\b
</Begin>
<RuleSet>
<Span color="Comment" ruleSet="CommentMarkerSet">
<Begin>//</Begin>
</Span>
</RuleSet>
</Span>
<Span> <!-- preprocessor directives that don't allow comments -->
<Begin fontWeight="bold">
(region|endregion|error|warning|pragma)\b
</Begin>
</Span>
</RuleSet>
</Span>
<Span color="Comment">
<Begin color="XmlDoc/DocComment">///(?!/)</Begin>
<RuleSet>
<Import ruleSet="XmlDoc/DocCommentSet"/>
<Import ruleSet="CommentMarkerSet"/>
</RuleSet>
</Span>
<Span color="Comment" ruleSet="CommentMarkerSet">
<Begin>//</Begin>
</Span>
<Span color="Comment" ruleSet="CommentMarkerSet" multiline="true">
<Begin>/\*</Begin>
<End>\*/</End>
</Span>
<Span color="String">
<Begin>"</Begin>
<End>"</End>
<RuleSet>
<!-- span for escape sequences -->
<Span begin="\\" end="."/>
</RuleSet>
</Span>
<Span color="Char">
<Begin>'</Begin>
<End>'</End>
<RuleSet>
<!-- span for escape sequences -->
<Span begin="\\" end="."/>
</RuleSet>
</Span>
<Span color="String" multiline="true">
<Begin color="String">@"</Begin>
<End>"</End>
<RuleSet>
<!-- span for escape sequences -->
<Span begin='""' end=""/>
</RuleSet>
</Span>
<Span color="String">
<Begin>\$"</Begin>
<End>"</End>
<RuleSet>
<!-- span for escape sequences -->
<Span begin="\\" end="."/>
<Span begin="\{\{" end=""/>
<!-- string interpolation -->
<Span begin="{" end="}" color="StringInterpolation" ruleSet=""/>
</RuleSet>
</Span>
<!-- Digits -->
<Rule color="NumberLiteral">
\b0[xX][0-9a-fA-F]+ # hex number
|
( \b\d+(\.[0-9]+)? #number with optional floating point
| \.[0-9]+ #or just starting with floating point
)
([eE][+-]?[0-9]+)? # optional exponent
</Rule>
</RuleSet>
</SyntaxDefinition>

10
ILSpy/TextView/CSharp-Mode.xshd

@ -39,8 +39,18 @@ @@ -39,8 +39,18 @@
<Color name="DelegateTypes" foreground="#004085" exampleText="System.#{#Action#}#; action;"/>
<Color name="ValueTypes" fontWeight="bold" foreground="#004085" exampleText="System.#{#DateTime#}# date;"/>
<Color name="EnumTypes" fontWeight="bold" foreground="#004085" exampleText="System.#{#ConsoleKey#}# key;"/>
<Color name="MethodDeclaration" exampleText="override string #{#ToString#}#() { }"/>
<Color name="MethodCall" foreground="MidnightBlue" fontWeight="bold" exampleText="o.#{#ToString#}#();"/>
<Color name="FieldDeclaration" exampleText="private int #{#name#}#;"/>
<Color name="FieldAccess" fontStyle="italic" exampleText="return this.#{#name#}#;"/>
<Color name="PropertyDeclaration" exampleText="private int #{#name#}# { get; set; }"/>
<Color name="PropertyAccess" exampleText="return this.#{#name#}#;"/>
<Color name="EventDeclaration" exampleText="private event Action #{#name#}#;"/>
<Color name="EventAccess" exampleText="this.#{#name#}#?.Invoke();"/>
<Color name="Variable" exampleText="var #{#name#}# = 42;"/>
<Color name="Parameter" exampleText="void Method(string #{#name#}#) { }"/>
<Color name="InactiveCode" foreground="Gray" exampleText="#{#Deactivated by #if#}#"/>
<Color name="SemanticError" foreground="DarkRed" exampleText="o.#{#MissingMethod#}#()"/>

18
ILSpy/TextView/DecompilerTextView.cs

@ -127,6 +127,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -127,6 +127,7 @@ namespace ICSharpCode.ILSpy.TextView
// SearchPanel
SearchPanel searchPanel = SearchPanel.Install(textEditor.TextArea);
searchPanel.RegisterCommands(Application.Current.MainWindow.CommandBindings);
searchPanel.SetResourceReference(SearchPanel.MarkerBrushProperty, ResourceKeys.SearchResultBackgroundBrush);
searchPanel.Loaded += (_, _) => {
// HACK: fix the hardcoded but misaligned margin of the search text box.
var textBox = searchPanel.VisualDescendants().OfType<TextBox>().FirstOrDefault();
@ -139,10 +140,6 @@ namespace ICSharpCode.ILSpy.TextView @@ -139,10 +140,6 @@ namespace ICSharpCode.ILSpy.TextView
ShowLineMargin();
SetHighlightCurrentLine();
// add marker service & margin
textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
ContextMenuProvider.Add(this);
textEditor.TextArea.TextView.SetResourceReference(ICSharpCode.AvalonEdit.Rendering.TextView.LinkTextForegroundBrushProperty, ResourceKeys.LinkTextForegroundBrush);
@ -1364,15 +1361,8 @@ namespace ICSharpCode.ILSpy.TextView @@ -1364,15 +1361,8 @@ namespace ICSharpCode.ILSpy.TextView
string[] extensions,
string resourceName)
{
if (ThemeManager.Current.IsDarkMode)
{
resourceName += "-Dark";
}
resourceName += ".xshd";
Stream? resourceStream = typeof(DecompilerTextView).Assembly
.GetManifestResourceStream(typeof(DecompilerTextView), resourceName);
.GetManifestResourceStream(typeof(DecompilerTextView), resourceName + ".xshd");
if (resourceStream != null)
{
@ -1382,7 +1372,9 @@ namespace ICSharpCode.ILSpy.TextView @@ -1382,7 +1372,9 @@ namespace ICSharpCode.ILSpy.TextView
using (resourceStream)
using (XmlTextReader reader = new XmlTextReader(resourceStream))
{
return HighlightingLoader.Load(reader, manager);
var highlightingDefinition = HighlightingLoader.Load(reader, manager);
ThemeManager.Current.ApplyHighlightingColors(highlightingDefinition);
return highlightingDefinition;
}
});
}

7
ILSpy/TextView/DecompilerTextView.xaml

@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
xmlns:local="clr-namespace:ICSharpCode.ILSpy.TextView"
xmlns:ae="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit"
xmlns:folding="clr-namespace:ICSharpCode.AvalonEdit.Folding;assembly=ICSharpCode.AvalonEdit"
xmlns:styles="urn:TomsToolbox.Wpf.Styles">
xmlns:styles="urn:TomsToolbox.Wpf.Styles"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="boolToVisibility" />
<SolidColorBrush x:Key="waitAdornerBackgoundBrush" Color="{DynamicResource {x:Static SystemColors.WindowColorKey}}" Opacity=".75"/>
@ -15,8 +16,8 @@ @@ -15,8 +16,8 @@
<Border BorderThickness="1,1,0,1" BorderBrush="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}">
<Grid>
<ae:TextEditor Name="textEditor" AutomationProperties.Name="Decompilation" FontFamily="Consolas" FontSize="10pt" IsReadOnly="True"
Background="{DynamicResource {x:Static SystemColors.InfoBrushKey}}"
Foreground="{DynamicResource {x:Static SystemColors.InfoTextBrushKey}}"
Background="{DynamicResource {x:Static themes:ResourceKeys.TextBackgroundBrush}}"
Foreground="{DynamicResource {x:Static themes:ResourceKeys.TextForegroundBrush}}"
folding:FoldingMargin.FoldingMarkerBackgroundBrush="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
folding:FoldingMargin.SelectedFoldingMarkerBackgroundBrush="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
folding:FoldingMargin.FoldingMarkerBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"

536
ILSpy/TextView/ILAsm-Mode-Dark.xshd

@ -1,536 +0,0 @@ @@ -1,536 +0,0 @@
<SyntaxDefinition name="ILAsm" extensions=".il" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Comment" foreground="#FF57A64A" exampleText="// comment" />
<Color name="String" foreground="#FFD69D85" exampleText="&quot;Hello, World!&quot;" />
<Color name="Instructions" foreground="#FFD69D85" exampleText="nop;" />
<Color name="Keywords" foreground="#FFD69D85" fontWeight="bold" exampleText="true" />
<Color name="Directives" foreground="#FF57A64A" fontWeight="bold" exampleText=".class" />
<Color name="Security" foreground="#FF559CD6" exampleText="request" />
<RuleSet ignoreCase="false">
<Keywords color="Instructions">
<Word>nop</Word>
<Word>break</Word>
<Word>ldarg.0</Word>
<Word>ldarg.1</Word>
<Word>ldarg.2</Word>
<Word>ldarg.3</Word>
<Word>ldloc.0</Word>
<Word>ldloc.1</Word>
<Word>ldloc.2</Word>
<Word>ldloc.3</Word>
<Word>stloc.0</Word>
<Word>stloc.1</Word>
<Word>stloc.2</Word>
<Word>stloc.3</Word>
<Word>ldarg.s</Word>
<Word>ldarga.s</Word>
<Word>starg.s</Word>
<Word>ldloc.s</Word>
<Word>ldloca.s</Word>
<Word>stloc.s</Word>
<Word>ldnull</Word>
<Word>ldc.i4.m1</Word>
<Word>ldc.i4.0</Word>
<Word>ldc.i4.1</Word>
<Word>ldc.i4.2</Word>
<Word>ldc.i4.3</Word>
<Word>ldc.i4.4</Word>
<Word>ldc.i4.5</Word>
<Word>ldc.i4.6</Word>
<Word>ldc.i4.7</Word>
<Word>ldc.i4.8</Word>
<Word>ldc.i4.s</Word>
<Word>ldc.i4</Word>
<Word>ldc.i8</Word>
<Word>ldc.r4</Word>
<Word>ldc.r8</Word>
<Word>dup</Word>
<Word>pop</Word>
<Word>jmp</Word>
<Word>call</Word>
<Word>calli</Word>
<Word>ret</Word>
<Word>br.s</Word>
<Word>brfalse.s</Word>
<Word>brtrue.s</Word>
<Word>beq.s</Word>
<Word>bge.s</Word>
<Word>bgt.s</Word>
<Word>ble.s</Word>
<Word>blt.s</Word>
<Word>bne.un.s</Word>
<Word>bge.un.s</Word>
<Word>bgt.un.s</Word>
<Word>ble.un.s</Word>
<Word>blt.un.s</Word>
<Word>br</Word>
<Word>brfalse</Word>
<Word>brtrue</Word>
<Word>beq</Word>
<Word>bge</Word>
<Word>bgt</Word>
<Word>ble</Word>
<Word>blt</Word>
<Word>bne.un</Word>
<Word>bge.un</Word>
<Word>bgt.un</Word>
<Word>ble.un</Word>
<Word>blt.un</Word>
<Word>switch</Word>
<Word>ldind.i1</Word>
<Word>ldind.u1</Word>
<Word>ldind.i2</Word>
<Word>ldind.u2</Word>
<Word>ldind.i4</Word>
<Word>ldind.u4</Word>
<Word>ldind.i8</Word>
<Word>ldind.i</Word>
<Word>ldind.r4</Word>
<Word>ldind.r8</Word>
<Word>ldind.ref</Word>
<Word>stind.ref</Word>
<Word>stind.i1</Word>
<Word>stind.i2</Word>
<Word>stind.i4</Word>
<Word>stind.i8</Word>
<Word>stind.r4</Word>
<Word>stind.r8</Word>
<Word>add</Word>
<Word>sub</Word>
<Word>mul</Word>
<Word>div</Word>
<Word>div.un</Word>
<Word>rem</Word>
<Word>rem.un</Word>
<Word>and</Word>
<Word>or</Word>
<Word>xor</Word>
<Word>shl</Word>
<Word>shr</Word>
<Word>shr.un</Word>
<Word>neg</Word>
<Word>not</Word>
<Word>conv.i1</Word>
<Word>conv.i2</Word>
<Word>conv.i4</Word>
<Word>conv.i8</Word>
<Word>conv.r4</Word>
<Word>conv.r8</Word>
<Word>conv.u4</Word>
<Word>conv.u8</Word>
<Word>callvirt</Word>
<Word>cpobj</Word>
<Word>ldobj</Word>
<Word>ldstr</Word>
<Word>newobj</Word>
<Word>castclass</Word>
<Word>isinst</Word>
<Word>conv.r.un</Word>
<Word>unbox</Word>
<Word>throw</Word>
<Word>ldfld</Word>
<Word>ldflda</Word>
<Word>stfld</Word>
<Word>ldsfld</Word>
<Word>ldsflda</Word>
<Word>stsfld</Word>
<Word>stobj</Word>
<Word>conv.ovf.i1.un</Word>
<Word>conv.ovf.i2.un</Word>
<Word>conv.ovf.i4.un</Word>
<Word>conv.ovf.i8.un</Word>
<Word>conv.ovf.u1.un</Word>
<Word>conv.ovf.u2.un</Word>
<Word>conv.ovf.u4.un</Word>
<Word>conv.ovf.u8.un</Word>
<Word>conv.ovf.i.un</Word>
<Word>conv.ovf.u.un</Word>
<Word>box</Word>
<Word>newarr</Word>
<Word>ldlen</Word>
<Word>ldelema</Word>
<Word>ldelem</Word>
<Word>ldelem.i1</Word>
<Word>ldelem.u1</Word>
<Word>ldelem.i2</Word>
<Word>ldelem.u2</Word>
<Word>ldelem.i4</Word>
<Word>ldelem.u4</Word>
<Word>ldelem.i8</Word>
<Word>ldelem.i</Word>
<Word>ldelem.r4</Word>
<Word>ldelem.r8</Word>
<Word>ldelem.ref</Word>
<Word>stelem</Word>
<Word>stelem.i</Word>
<Word>stelem.i1</Word>
<Word>stelem.i2</Word>
<Word>stelem.i4</Word>
<Word>stelem.i8</Word>
<Word>stelem.r4</Word>
<Word>stelem.r8</Word>
<Word>stelem.ref</Word>
<Word>conv.ovf.i1</Word>
<Word>conv.ovf.u1</Word>
<Word>conv.ovf.i2</Word>
<Word>conv.ovf.u2</Word>
<Word>conv.ovf.i4</Word>
<Word>conv.ovf.u4</Word>
<Word>conv.ovf.i8</Word>
<Word>conv.ovf.u8</Word>
<Word>refanyval</Word>
<Word>ckfinite</Word>
<Word>mkrefany</Word>
<Word>ldtoken</Word>
<Word>conv.u2</Word>
<Word>conv.u1</Word>
<Word>conv.i</Word>
<Word>conv.ovf.i</Word>
<Word>conv.ovf.u</Word>
<Word>add.ovf</Word>
<Word>add.ovf.un</Word>
<Word>mul.ovf</Word>
<Word>mul.ovf.un</Word>
<Word>sub.ovf</Word>
<Word>sub.ovf.un</Word>
<Word>endfinally</Word>
<Word>leave</Word>
<Word>leave.s</Word>
<Word>stind.i</Word>
<Word>conv.u</Word>
<Word>prefix7</Word>
<Word>prefix6</Word>
<Word>prefix5</Word>
<Word>prefix4</Word>
<Word>prefix3</Word>
<Word>prefix2</Word>
<Word>prefix1</Word>
<Word>prefixref</Word>
<Word>arglist</Word>
<Word>ceq</Word>
<Word>cgt</Word>
<Word>cgt.un</Word>
<Word>clt</Word>
<Word>clt.un</Word>
<Word>ldftn</Word>
<Word>ldvirtftn</Word>
<Word>ldarg</Word>
<Word>ldarga</Word>
<Word>starg</Word>
<Word>ldloc</Word>
<Word>ldloca</Word>
<Word>stloc</Word>
<Word>localloc</Word>
<Word>endfilter</Word>
<Word>unaligned.</Word>
<Word>volatile.</Word>
<Word>tail.</Word>
<Word>initobj</Word>
<Word>cpblk</Word>
<Word>initblk</Word>
<Word>rethrow</Word>
<Word>sizeof</Word>
<Word>refanytype</Word>
<Word>illegal</Word>
<Word>endmac</Word>
<Word>brnull</Word>
<Word>brnull.s</Word>
<Word>brzero</Word>
<Word>brzero.s</Word>
<Word>brinst</Word>
<Word>brinst.s</Word>
<Word>ldind.u8</Word>
<Word>ldelem.u8</Word>
<Word>ldc.i4.M1</Word>
<Word>endfault</Word>
</Keywords>
<Keywords color="Keywords">
<Word>void</Word>
<Word>bool</Word>
<Word>char</Word>
<Word>wchar</Word>
<Word>int</Word>
<Word>int8</Word>
<Word>int16</Word>
<Word>int32</Word>
<Word>int64</Word>
<Word>uint8</Word>
<Word>uint16</Word>
<Word>uint32</Word>
<Word>uint64</Word>
<Word>float</Word>
<Word>float32</Word>
<Word>float64</Word>
<Word>refany</Word>
<Word>typedref</Word>
<Word>object</Word>
<Word>string</Word>
<Word>native</Word>
<Word>unsigned</Word>
<Word>value</Word>
<Word>valuetype</Word>
<Word>class</Word>
<Word>const</Word>
<Word>vararg</Word>
<Word>default</Word>
<Word>stdcall</Word>
<Word>thiscall</Word>
<Word>fastcall</Word>
<Word>unmanaged</Word>
<Word>not_in_gc_heap</Word>
<Word>beforefieldinit</Word>
<Word>instance</Word>
<Word>filter</Word>
<Word>catch</Word>
<Word>static</Word>
<Word>public</Word>
<Word>private</Word>
<Word>synchronized</Word>
<Word>interface</Word>
<Word>extends</Word>
<Word>implements</Word>
<Word>handler</Word>
<Word>finally</Word>
<Word>fault</Word>
<Word>to</Word>
<Word>abstract</Word>
<Word>auto</Word>
<Word>sequential</Word>
<Word>explicit</Word>
<Word>wrapper</Word>
<Word>ansi</Word>
<Word>unicode</Word>
<Word>autochar</Word>
<Word>import</Word>
<Word>enum</Word>
<Word>virtual</Word>
<Word>notremotable</Word>
<Word>special</Word>
<Word>il</Word>
<Word>cil</Word>
<Word>optil</Word>
<Word>managed</Word>
<Word>preservesig</Word>
<Word>runtime</Word>
<Word>method</Word>
<Word>field</Word>
<Word>bytearray</Word>
<Word>final</Word>
<Word>sealed</Word>
<Word>specialname</Word>
<Word>family</Word>
<Word>assembly</Word>
<Word>famandassem</Word>
<Word>famorassem</Word>
<Word>privatescope</Word>
<Word>nested</Word>
<Word>hidebysig</Word>
<Word>newslot</Word>
<Word>rtspecialname</Word>
<Word>pinvokeimpl</Word>
<Word>unmanagedexp</Word>
<Word>reqsecobj</Word>
<Word>.ctor</Word>
<Word>.cctor</Word>
<Word>initonly</Word>
<Word>literal</Word>
<Word>notserialized</Word>
<Word>forwardref</Word>
<Word>internalcall</Word>
<Word>noinlining</Word>
<Word>aggressiveinlining</Word>
<Word>nomangle</Word>
<Word>lasterr</Word>
<Word>winapi</Word>
<Word>cdecl</Word>
<Word>stdcall</Word>
<Word>thiscall</Word>
<Word>fastcall</Word>
<Word>as</Word>
<Word>pinned</Word>
<Word>modreq</Word>
<Word>modopt</Word>
<Word>serializable</Word>
<Word>at</Word>
<Word>tls</Word>
<Word>true</Word>
<Word>false</Word>
<Word>strict</Word>
<Word>type</Word>
</Keywords>
<Keywords color="Directives">
<Word>.class</Word>
<Word>.namespace</Word>
<Word>.method</Word>
<Word>.field</Word>
<Word>.emitbyte</Word>
<Word>.try</Word>
<Word>.maxstack</Word>
<Word>.locals</Word>
<Word>.entrypoint</Word>
<Word>.zeroinit</Word>
<Word>.pdirect</Word>
<Word>.data</Word>
<Word>.event</Word>
<Word>.addon</Word>
<Word>.removeon</Word>
<Word>.fire</Word>
<Word>.other</Word>
<Word>protected</Word>
<Word>.property</Word>
<Word>.set</Word>
<Word>.get</Word>
<Word>default</Word>
<Word>.import</Word>
<Word>.permission</Word>
<Word>.permissionset</Word>
<Word>.line</Word>
<Word>.language</Word>
<Word>.interfaceimpl</Word>
<Word>#line</Word>
</Keywords>
<Keywords color="Security">
<Word>request</Word>
<Word>demand</Word>
<Word>assert</Word>
<Word>deny</Word>
<Word>permitonly</Word>
<Word>linkcheck</Word>
<Word>inheritcheck</Word>
<Word>reqmin</Word>
<Word>reqopt</Word>
<Word>reqrefuse</Word>
<Word>prejitgrant</Word>
<Word>prejitdeny</Word>
<Word>noncasdemand</Word>
<Word>noncaslinkdemand</Word>
<Word>noncasinheritance</Word>
</Keywords>
<Keywords color="Directives">
<!-- custom value specifier -->
<Word>.custom</Word>
<!-- IL method attribute -->
<Word>init</Word>
<!-- Class layout directives -->
<Word>.size</Word>
<Word>.pack</Word>
<!-- Manifest-related keywords -->
<Word>.file</Word>
<Word>nometadata</Word>
<Word>.hash</Word>
<Word>.assembly</Word>
<Word>implicitcom</Word>
<Word>noappdomain</Word>
<Word>noprocess</Word>
<Word>nomachine</Word>
<Word>.publickey</Word>
<Word>.publickeytoken</Word>
<Word>algorithm</Word>
<Word>.ver</Word>
<Word>.locale</Word>
<Word>extern</Word>
<Word>.export</Word>
<Word>.manifestres</Word>
<Word>.mresource</Word>
<Word>.localized</Word>
<!-- Field marshaling keywords -->
<Word>.module</Word>
<Word>marshal</Word>
<Word>custom</Word>
<Word>sysstring</Word>
<Word>fixed</Word>
<Word>variant</Word>
<Word>currency</Word>
<Word>syschar</Word>
<Word>decimal</Word>
<Word>date</Word>
<Word>bstr</Word>
<Word>tbstr</Word>
<Word>lpstr</Word>
<Word>lpwstr</Word>
<Word>lptstr</Word>
<Word>objectref</Word>
<Word>iunknown</Word>
<Word>idispatch</Word>
<Word>struct</Word>
<Word>safearray</Word>
<Word>byvalstr</Word>
<Word>lpvoid</Word>
<Word>any</Word>
<Word>array</Word>
<Word>lpstruct</Word>
<!-- VTable fixup keywords -->
<Word>.vtfixup</Word>
<Word>fromunmanaged</Word>
<Word>callmostderived</Word>
<Word>.vtentry</Word>
<!-- Parameter attributes -->
<Word>in</Word>
<Word>out</Word>
<Word>opt</Word>
<Word>lcid</Word>
<Word>retval</Word>
<Word>.param</Word>
<!-- Method implementations -->
<Word>.override</Word>
<Word>with</Word>
<!-- VariantType keywords -->
<Word>null</Word>
<Word>error</Word>
<Word>hresult</Word>
<Word>carray</Word>
<Word>userdefined</Word>
<Word>record</Word>
<Word>filetime</Word>
<Word>blob</Word>
<Word>stream</Word>
<Word>storage</Word>
<Word>streamed_object</Word>
<Word>stored_object</Word>
<Word>blob_object</Word>
<Word>cf</Word>
<Word>clsid</Word>
<Word>vector</Word>
<!-- Null reference keyword for InitOpt -->
<Word>nullref</Word>
<!-- Header flags keywords -->
<Word>.subsystem</Word>
<Word>.corflags</Word>
<Word>.stackreserve</Word>
<Word>alignment</Word>
<Word>.imagebase</Word>
</Keywords>
<Span color="Comment" ruleSet="CommentMarkerSet">
<Begin>//</Begin>
</Span>
<Span color="Comment" ruleSet="CommentMarkerSet">
<Begin>/\*</Begin>
<End>\*/</End>
</Span>
<Span color="String">
<Begin>"</Begin>
<End>"</End>
</Span>
<Span>
<Begin>'</Begin>
<End>'</End>
</Span>
</RuleSet>
<RuleSet name="CommentMarkerSet" ignoreCase="false">
<Keywords foreground="#FFFF0000" fontWeight="bold">
<Word>TODO</Word>
<Word>FIXME</Word>
</Keywords>
<Keywords foreground="#EEE0E000" fontWeight="bold">
<Word>HACK</Word>
<Word>UNDONE</Word>
</Keywords>
</RuleSet>
</SyntaxDefinition>

6
ILSpy/TextView/ILAsm-Mode.xshd

@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
<Color name="Keywords" foreground="Blue" fontWeight="bold" exampleText="true" />
<Color name="Directives" foreground="Green" fontWeight="bold" exampleText=".class" />
<Color name="Security" foreground="Red" exampleText="request" />
<Color name="Label" exampleText="IL_0000:" />
<RuleSet ignoreCase="false">
<Keywords color="Instructions">
<Word>nop</Word>
@ -522,6 +523,9 @@ @@ -522,6 +523,9 @@
<Begin>'</Begin>
<End>'</End>
</Span>
<Rule color="Label">
^ \s* \w+ :
</Rule>
</RuleSet>
<RuleSet name="CommentMarkerSet" ignoreCase="false">
<Keywords foreground="#FFFF0000" fontWeight="bold">

63
ILSpy/TextView/XML-Mode-Dark.xshd

@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
<SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.booproj;.build;.xfrm;.targets;.xaml;.xpt;.xft;.map;.wsdl;.disco;.ps1xml;.nuspec" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color foreground="Green" name="Comment" exampleText="&lt;!-- comment --&gt;" />
<Color foreground="#FFD69D85" name="CData" exampleText="&lt;![CDATA[data]]&gt;" />
<Color foreground="#FFD69D85" name="DocType" exampleText="&lt;!DOCTYPE rootElement&gt;" />
<Color foreground="#FFD69D85" name="XmlDeclaration" exampleText='&lt;?xml version="1.0"?&gt;' />
<Color foreground="#FFD69D85" name="XmlTag" exampleText='&lt;tag attribute="value" /&gt;' />
<Color foreground="#FF00A0FF" name="AttributeName" exampleText='&lt;tag attribute="value" /&gt;' />
<Color foreground="#FFD69D85" name="AttributeValue" exampleText='&lt;tag attribute="value" /&gt;' />
<Color foreground="#FFd8a0df" name="Entity" exampleText="index.aspx?a=1&amp;amp;b=2" />
<Color foreground="#FF559CD6" name="BrokenEntity" exampleText="index.aspx?a=1&amp;b=2" />
<RuleSet>
<Span color="Comment" multiline="true">
<Begin>&lt;!--</Begin>
<End>--&gt;</End>
</Span>
<Span color="CData" multiline="true">
<Begin>&lt;!\[CDATA\[</Begin>
<End>]]&gt;</End>
</Span>
<Span color="DocType" multiline="true">
<Begin>&lt;!DOCTYPE</Begin>
<End>&gt;</End>
</Span>
<Span color="XmlDeclaration" multiline="true">
<Begin>&lt;\?</Begin>
<End>\?&gt;</End>
</Span>
<Span color="XmlTag" multiline="true">
<Begin>&lt;</Begin>
<End>&gt;</End>
<RuleSet>
<!-- Treat the position before '<' as end, as that's not a valid character
in attribute names and indicates the user forgot a closing quote. -->
<Span color="AttributeValue" multiline="true" ruleSet="EntitySet">
<Begin>"</Begin>
<End>"|(?=&lt;)</End>
</Span>
<Span color="AttributeValue" multiline="true" ruleSet="EntitySet">
<Begin>'</Begin>
<End>'|(?=&lt;)</End>
</Span>
<Rule color="AttributeName">[\d\w_\-\.]+(?=(\s*=))</Rule>
<Rule color="AttributeValue">=</Rule>
</RuleSet>
</Span>
<Import ruleSet="EntitySet"/>
</RuleSet>
<RuleSet name="EntitySet">
<Rule color="Entity">
&amp;
[\w\d\#]+
;
</Rule>
<Rule color="BrokenEntity">
&amp;
[\w\d\#]*
#missing ;
</Rule>
</RuleSet>
</SyntaxDefinition>

8
ILSpy/Themes/DarkTheme.xaml → ILSpy/Themes/Base.Dark.xaml

@ -6,6 +6,10 @@ @@ -6,6 +6,10 @@
<ResourceDictionary Source="/AvalonDock.Themes.VS2013;component/darktheme.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextBackgroundBrush}" Color="Black" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextForegroundBrush}" Color="White" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.SearchResultBackgroundBrush}" Color="#995A23" />
<Color x:Key="{x:Static SystemColors.ControlLightLightColorKey}">#333337</Color>
<Color x:Key="{x:Static SystemColors.ControlLightColorKey}">#464646</Color>
<Color x:Key="{x:Static SystemColors.ControlColorKey}">#252526</Color>
@ -60,4 +64,6 @@ @@ -60,4 +64,6 @@
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerBackgroundColor}">MediumVioletRed</Color>
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.LinkTextForegroundBrush}">CornflowerBlue</SolidColorBrush>
</ResourceDictionary>
<styles:InvertGrayEffect x:Key="{x:Static themes:ResourceKeys.ThemeAwareButtonEffect}" />
</ResourceDictionary>

7
ILSpy/Themes/LightTheme.xaml → ILSpy/Themes/Base.Light.xaml

@ -6,6 +6,10 @@ @@ -6,6 +6,10 @@
<ResourceDictionary Source="/AvalonDock.Themes.VS2013;component/lighttheme.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextBackgroundBrush}" Color="White" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextForegroundBrush}" Color="Black" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.SearchResultBackgroundBrush}">LightGreen</SolidColorBrush>
<Color x:Key="{x:Static SystemColors.ControlLightLightColorKey}">#FCFCFC</Color>
<Color x:Key="{x:Static SystemColors.ControlLightColorKey}">#D8D8E0</Color>
<Color x:Key="{x:Static SystemColors.ControlColorKey}">#F5F5F5</Color>
@ -53,4 +57,5 @@ @@ -53,4 +57,5 @@
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.BorderBrush}" Color="#CCCEDB" />
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.DisabledBrush}" Color="#EEEEF2" />
</ResourceDictionary>
</ResourceDictionary>

14
ILSpy/Themes/ResourceKeys.cs

@ -22,10 +22,14 @@ namespace ICSharpCode.ILSpy.Themes @@ -22,10 +22,14 @@ namespace ICSharpCode.ILSpy.Themes
{
public static class ResourceKeys
{
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");
public static ResourceKey TextBackgroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(TextBackgroundBrush));
public static ResourceKey TextForegroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(TextForegroundBrush));
public static ResourceKey TextMarkerBackgroundColor = new ComponentResourceKey(typeof(ResourceKeys), nameof(TextMarkerBackgroundColor));
public static ResourceKey TextMarkerDefinitionBackgroundColor = new ComponentResourceKey(typeof(ResourceKeys), nameof(TextMarkerDefinitionBackgroundColor));
public static ResourceKey SearchResultBackgroundBrush = new ComponentResourceKey(typeof(ResourceKeys), nameof(SearchResultBackgroundBrush));
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 ThemeAwareButtonEffect = new ComponentResourceKey(typeof(ResourceKeys), nameof(ThemeAwareButtonEffect));
}
}

32
ILSpy/Themes/SyntaxColor.cs

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
#nullable enable
using System.Windows;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Highlighting;
namespace ICSharpCode.ILSpy.Themes;
public class SyntaxColor
{
public Color? Foreground { get; set; }
public Color? Background { get; set; }
public FontWeight? FontWeight { get; set; }
public FontStyle? FontStyle { get; set; }
public void ApplyTo(HighlightingColor color)
{
color.Foreground = Foreground is { } foreground ? new SimpleHighlightingBrush(foreground) : null;
color.Background = Background is { } background ? new SimpleHighlightingBrush(background) : null;
color.FontWeight = FontWeight ?? FontWeights.Normal;
color.FontStyle = FontStyle ?? FontStyles.Normal;
}
public static void ResetColor(HighlightingColor color)
{
color.Foreground = null;
color.Background = null;
color.FontWeight = null;
color.FontStyle = null;
}
}

91
ILSpy/Themes/Theme.Dark.xaml

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base.Dark.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextBackgroundBrush}" Color="#333337" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextForegroundBrush}" Color="#F1F1F1" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.SearchResultBackgroundBrush}" Color="#995A23" />
<!-- ILAsm -->
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Comment" Foreground="#FF57A64A" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.String" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Instructions" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Keywords" Foreground="#FFD69D85" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Directives" Foreground="#FF57A64A" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Security" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Label" />
<!-- Asm -->
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Comment" Foreground="#FF57A64A" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.NumberLiteral" Foreground="Orange" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.String" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Instructions" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Math Instructions" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Extended Instructions" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Registers" Foreground="#8080FF" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directives" Foreground="#FFD69D85" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directive Operands" Foreground="#FFb5cea8" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Address and Bytes" />
<!-- CSharp -->
<themes:SyntaxColor x:Key="SyntaxColor.C#.Comment" Foreground="#FF57A64A" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.String" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.StringInterpolation" Foreground="#FFffd68f" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Char" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Preprocessor" Foreground="#FF9B9B9B" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Punctuation" Foreground="White" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypeKeywords" Foreground="#FF00A0FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypeKeywords" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NumberLiteral" Foreground="#FFb5cea8" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ThisOrBaseReference" Foreground="#FF3a6a9b" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NullOrValueKeywords" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Keywords" Foreground="#FFd8a0df" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GotoKeywords" Foreground="#FFd8a0df" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.QueryKeywords" Foreground="#FFd8a0df" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ExceptionKeywords" Foreground="#FFd8a0df" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.CheckedKeyword" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.UnsafeKeywords" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.OperatorKeywords" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ParameterModifiers" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Modifiers" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Visibility" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NamespaceKeywords" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GetSetAddRemove" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TrueFalse" Foreground="#FF00A0FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeKeywords" Foreground="#FF559CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.AttributeKeywords" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypes" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InterfaceTypes" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeParameters" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.DelegateTypes" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypes" FontWeight="Bold" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EnumTypes" FontWeight="Bold" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodDeclaration" Foreground="#FFdcdcaa" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodCall" Foreground="#FFdcdcaa" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldDeclaration" FontStyle="Italic" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldAccess" FontStyle="Italic" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyDeclaration" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyAccess" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventDeclaration" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventAccess" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Variable" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Parameter" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InactiveCode" Foreground="Gray" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.SemanticError" Foreground="DarkRed" />
<!-- XML -->
<themes:SyntaxColor x:Key="SyntaxColor.XML.Comment" Foreground="Green" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.CData" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.DocType" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlDeclaration" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlTag" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeName" Foreground="#FF00A0FF" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeValue" Foreground="#FFD69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.Entity" Foreground="#FFd8a0df" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.BrokenEntity" Foreground="#FF559CD6" />
</ResourceDictionary>

91
ILSpy/Themes/Theme.Light.xaml

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base.Light.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextBackgroundBrush}" Color="{DynamicResource {x:Static SystemColors.InfoColorKey}}" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextForegroundBrush}" Color="{DynamicResource {x:Static SystemColors.InfoTextColorKey}}" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.SearchResultBackgroundBrush}" Color="LightGreen" />
<!-- ILAsm -->
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Comment" Foreground="Green" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.String" Foreground="Magenta" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Instructions" Foreground="Blue" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Keywords" Foreground="Blue" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Directives" Foreground="Green" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Security" Foreground="Red" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Label" />
<!-- Asm -->
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Comment" Foreground="Green" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.NumberLiteral" Foreground="Orange" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.String" Foreground="Magenta" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Instructions" Foreground="Blue" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Math Instructions" Foreground="#0080C0" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Extended Instructions" Foreground="Brown" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Registers" Foreground="#8080FF" Background="#EEEEEE" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directives" Foreground="Blue" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directive Operands" Foreground="DarkBlue" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Address and Bytes" />
<!-- CSharp -->
<themes:SyntaxColor x:Key="SyntaxColor.C#.Comment" Foreground="Green" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.String" Foreground="Blue" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.StringInterpolation" Foreground="Black" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Char" Foreground="Magenta" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Preprocessor" Foreground="Green" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Punctuation" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypeKeywords" Foreground="Red" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypeKeywords" Foreground="Red" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NumberLiteral" Foreground="DarkBlue" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ThisOrBaseReference" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NullOrValueKeywords" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Keywords" Foreground="Blue" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GotoKeywords" Foreground="Navy" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.QueryKeywords" Foreground="Navy" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ExceptionKeywords" Foreground="Teal" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.CheckedKeyword" Foreground="DarkGray" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.UnsafeKeywords" Foreground="Olive" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.OperatorKeywords" Foreground="Pink" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ParameterModifiers" Foreground="DeepPink" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Modifiers" Foreground="Brown" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Visibility" Foreground="Blue" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NamespaceKeywords" Foreground="Green" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GetSetAddRemove" Foreground="SaddleBrown" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TrueFalse" Foreground="DarkCyan" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeKeywords" Foreground="DarkCyan" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.AttributeKeywords" Foreground="Navy" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypes" Foreground="#004085" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InterfaceTypes" Foreground="#004085" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeParameters" Foreground="#004085" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.DelegateTypes" Foreground="#004085" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypes" FontWeight="Bold" Foreground="#004085" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EnumTypes" FontWeight="Bold" Foreground="#004085" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodDeclaration" Foreground="MidnightBlue" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodCall" Foreground="MidnightBlue" FontWeight="Bold" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldDeclaration" FontStyle="Italic" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldAccess" FontStyle="Italic" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyDeclaration" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyAccess" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventDeclaration" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventAccess" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Variable" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Parameter" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InactiveCode" Foreground="Gray" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.SemanticError" Foreground="DarkRed" />
<!-- XML -->
<themes:SyntaxColor x:Key="SyntaxColor.XML.Comment" Foreground="Green" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.CData" Foreground="Blue" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.DocType" Foreground="Blue" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlDeclaration" Foreground="Blue" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlTag" Foreground="DarkMagenta" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeName" Foreground="Red" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeValue" Foreground="Blue" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.Entity" Foreground="Teal" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.BrokenEntity" Foreground="Olive" />
</ResourceDictionary>

96
ILSpy/Themes/Theme.RSharpDark.xaml

@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base.Dark.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Inspired from the ReSharper Dark theme, with some changes -->
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextBackgroundBrush}" Color="#1E1E1E" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextForegroundBrush}" Color="#DCDCDC" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.SearchResultBackgroundBrush}">#995A23</SolidColorBrush>
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerBackgroundColor}">#483D8B</Color>
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerDefinitionBackgroundColor}">#800000</Color>
<!-- ILAsm -->
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Comment" Foreground="#57A64A" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.String" Foreground="#D69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Instructions" Foreground="#D2691E" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Keywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Directives" Foreground="#ADD8E6" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Security" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Label" Foreground="#696969" />
<!-- Asm -->
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Comment" Foreground="#57A64A" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.NumberLiteral" Foreground="#B5CEA8" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.String" Foreground="#D69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Instructions" Foreground="#D2691E" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Math Instructions" Foreground="#D2691E" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Extended Instructions" Foreground="#D2691E" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Registers" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directives" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directive Operands" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Address and Bytes" Foreground="#696969" />
<!-- CSharp -->
<themes:SyntaxColor x:Key="SyntaxColor.C#.Comment" Foreground="#57A64A" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.String" Foreground="#D69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.StringInterpolation" Foreground="#80FF80" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Char" Foreground="#D69D85" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Preprocessor" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Punctuation" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypeKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypeKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NumberLiteral" Foreground="#B5CEA8" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ThisOrBaseReference" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NullOrValueKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Keywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GotoKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.QueryKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ExceptionKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.CheckedKeyword" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.UnsafeKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.OperatorKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ParameterModifiers" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Modifiers" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Visibility" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NamespaceKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GetSetAddRemove" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TrueFalse" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.AttributeKeywords" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypes" Foreground="#ADD8E6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InterfaceTypes" Foreground="#ADD8E6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeParameters" Foreground="#ADD8E6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.DelegateTypes" Foreground="#ADD8E6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypes" Foreground="#ADB0E6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EnumTypes" Foreground="#ADB0E6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodDeclaration" Foreground="#00FFFF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodCall" Foreground="#00FFFF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldDeclaration" Foreground="#C4ADE6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldAccess" Foreground="#C4ADE6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyDeclaration" Foreground="#C4ADE6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyAccess" Foreground="#C4ADE6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventDeclaration" Foreground="#DDA0DD" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventAccess" Foreground="#DDA0DD" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Variable" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Parameter" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InactiveCode" Foreground="#A9A9A9" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.SemanticError" Foreground="#FF3333" />
<!-- XML -->
<themes:SyntaxColor x:Key="SyntaxColor.XML.Comment" Foreground="#57A64A" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.CData" Foreground="#C8C8C8" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.DocType" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlDeclaration" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlTag" Foreground="#569CD6" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeName" Foreground="#92CAF4" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeValue" Foreground="#C8C8C8" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.Entity" Foreground="#92CAF4" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.BrokenEntity" Foreground="#92CAF4" />
</ResourceDictionary>

96
ILSpy/Themes/Theme.RSharpLight.xaml

@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base.Light.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Inspired from the ReSharper Light theme, with some changes -->
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextBackgroundBrush}" Color="White" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextForegroundBrush}" Color="Black" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.SearchResultBackgroundBrush}">#F6B94D</SolidColorBrush>
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerBackgroundColor}">#87CEFA</Color>
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerDefinitionBackgroundColor}">#FFB6C1</Color>
<!-- ILAsm -->
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Comment" Foreground="#007F00" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.String" Foreground="#A31515" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Instructions" Foreground="#D2691E" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Keywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Directives" Foreground="#00008B" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Security" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Label" Foreground="#398A8A" />
<!-- Asm -->
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Comment" Foreground="#007F00" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.NumberLiteral" Foreground="#000000" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.String" Foreground="#A31515" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Instructions" Foreground="#D2691E" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Math Instructions" Foreground="#D2691E" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Extended Instructions" Foreground="#D2691E" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Registers" Foreground="#1F377F" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directives" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directive Operands" Foreground="#1F377F" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Address and Bytes" Foreground="#398A8A" />
<!-- CSharp -->
<themes:SyntaxColor x:Key="SyntaxColor.C#.Comment" Foreground="#007F00" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.String" Foreground="#A31515" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.StringInterpolation" Foreground="#008000" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Char" Foreground="#A31515" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Preprocessor" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Punctuation" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypeKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypeKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NumberLiteral" Foreground="#000000" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ThisOrBaseReference" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NullOrValueKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Keywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GotoKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.QueryKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ExceptionKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.CheckedKeyword" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.UnsafeKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.OperatorKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ParameterModifiers" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Modifiers" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Visibility" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NamespaceKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GetSetAddRemove" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TrueFalse" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.AttributeKeywords" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypes" Foreground="#00008B" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InterfaceTypes" Foreground="#00008B" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeParameters" Foreground="#00008B" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.DelegateTypes" Foreground="#00008B" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypes" Foreground="#3F008F" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EnumTypes" Foreground="#3F008F" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodDeclaration" Foreground="#008B8B" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodCall" Foreground="#008B8B" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldDeclaration" Foreground="#660E7A" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldAccess" Foreground="#660E7A" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyDeclaration" Foreground="#660E7A" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyAccess" Foreground="#660E7A" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventDeclaration" Foreground="#FF00FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventAccess" Foreground="#FF00FF" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Variable" Foreground="#1F377F" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Parameter" Foreground="#1F377F" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InactiveCode" Foreground="#A9A9A9" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.SemanticError" Foreground="#FF0000" />
<!-- XML -->
<themes:SyntaxColor x:Key="SyntaxColor.XML.Comment" Foreground="#007F00" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.CData" Foreground="#000000" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.DocType" Foreground="#A31515" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlDeclaration" Foreground="#A31515" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlTag" Foreground="#A31515" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeName" Foreground="#FF0000" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeValue" Foreground="#0000FF" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.Entity" Foreground="#FF0000" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.BrokenEntity" Foreground="#FF0000" />
</ResourceDictionary>

101
ILSpy/Themes/Theme.VSCodeDarkPlus.xaml

@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base.Dark.xaml" />
</ResourceDictionary.MergedDictionaries>
<!--
Colors taken from the VS Code Dark+ theme
https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/dark_vs.json
https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/dark_plus.json
-->
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextBackgroundBrush}" Color="#1E1E1E" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextForegroundBrush}" Color="#D4D4D4" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.SearchResultBackgroundBrush}" Color="#613214" />
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerBackgroundColor}">#264F78</Color>
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerDefinitionBackgroundColor}">#343A40</Color>
<!-- ILAsm -->
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Comment" Foreground="#6A9955" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.String" Foreground="#ce9178" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Instructions" Foreground="#C586C0" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Keywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Directives" Foreground="#DCDCAA" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Security" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Label" Foreground="#6A9955" />
<!-- Asm -->
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Comment" Foreground="#6A9955" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.NumberLiteral" Foreground="#b5cea8" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.String" Foreground="#ce9178" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Instructions" Foreground="#C586C0" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Math Instructions" Foreground="#C586C0" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Extended Instructions" Foreground="#C586C0" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Registers" Foreground="#DCDCAA" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directives" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directive Operands" Foreground="#DCDCAA" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Address and Bytes" Foreground="#ce9178" />
<!-- CSharp -->
<themes:SyntaxColor x:Key="SyntaxColor.C#.Comment" Foreground="#6A9955" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.String" Foreground="#ce9178" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.StringInterpolation" Foreground="#d16969" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Char" Foreground="#ce9178" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Preprocessor" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Punctuation" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypeKeywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypeKeywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NumberLiteral" Foreground="#b5cea8" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ThisOrBaseReference" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NullOrValueKeywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Keywords" Foreground="#C586C0" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GotoKeywords" Foreground="#C586C0" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.QueryKeywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ExceptionKeywords" Foreground="#C586C0" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.CheckedKeyword" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.UnsafeKeywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.OperatorKeywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ParameterModifiers" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Modifiers" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Visibility" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NamespaceKeywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GetSetAddRemove" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TrueFalse" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeKeywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.AttributeKeywords" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypes" Foreground="#4EC9B0" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InterfaceTypes" Foreground="#4EC9B0" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeParameters" Foreground="#4EC9B0" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.DelegateTypes" Foreground="#4EC9B0" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypes" Foreground="#4EC9B0" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EnumTypes" Foreground="#4EC9B0" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodDeclaration" Foreground="#DCDCAA" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodCall" Foreground="#DCDCAA" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldDeclaration" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldAccess" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyDeclaration" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyAccess" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventDeclaration" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventAccess" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Variable" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Parameter" Foreground="#9CDCFE" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InactiveCode" Foreground="#A6A6A6" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.SemanticError" Foreground="#f44747" />
<!-- XML -->
<themes:SyntaxColor x:Key="SyntaxColor.XML.Comment" Foreground="#6A9955" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.CData" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.DocType" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlDeclaration" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlTag" Foreground="#569cd6" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeName" Foreground="#9cdcfe" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeValue" Foreground="#ce9178" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.Entity" Foreground="#b5cea8" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.BrokenEntity" Foreground="#f44747" />
</ResourceDictionary>

101
ILSpy/Themes/Theme.VSCodeLightPlus.xaml

@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base.Light.xaml" />
</ResourceDictionary.MergedDictionaries>
<!--
Colors taken from the VS Code Light+ theme
https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/light_vs.json
https://github.com/microsoft/vscode/blob/main/extensions/theme-defaults/themes/light_plus.json
-->
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextBackgroundBrush}" Color="White" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.TextForegroundBrush}" Color="Black" />
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.SearchResultBackgroundBrush}" Color="#F8C9AB" />
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerBackgroundColor}">#ADD6FF</Color>
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerDefinitionBackgroundColor}">#D6EAFF</Color>
<!-- ILAsm -->
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Comment" Foreground="#008000" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.String" Foreground="#a31515" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Instructions" Foreground="#AF00DB" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Keywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Directives" Foreground="#795E26" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Security" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.ILAsm.Label" Foreground="#0451a5" />
<!-- Asm -->
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Comment" Foreground="#008000" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.NumberLiteral" Foreground="#098658" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.String" Foreground="#a31515" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Instructions" Foreground="#AF00DB" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Math Instructions" Foreground="#AF00DB" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Extended Instructions" Foreground="#AF00DB" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Registers" Foreground="#795E26" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directives" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Directive Operands" Foreground="#795E26" />
<themes:SyntaxColor x:Key="SyntaxColor.Asm.Address and Bytes" Foreground="#0451a5" />
<!-- CSharp -->
<themes:SyntaxColor x:Key="SyntaxColor.C#.Comment" Foreground="#008000" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.String" Foreground="#a31515" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.StringInterpolation" Foreground="#d16969" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Char" Foreground="#a31515" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Preprocessor" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Punctuation" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypeKeywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypeKeywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NumberLiteral" Foreground="#098658" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ThisOrBaseReference" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NullOrValueKeywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Keywords" Foreground="#AF00DB" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GotoKeywords" Foreground="#AF00DB" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.QueryKeywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ExceptionKeywords" Foreground="#AF00DB" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.CheckedKeyword" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.UnsafeKeywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.OperatorKeywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ParameterModifiers" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Modifiers" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Visibility" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.NamespaceKeywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.GetSetAddRemove" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TrueFalse" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeKeywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.AttributeKeywords" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ReferenceTypes" Foreground="#267f99" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InterfaceTypes" Foreground="#267f99" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.TypeParameters" Foreground="#267f99" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.DelegateTypes" Foreground="#267f99" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.ValueTypes" Foreground="#267f99" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EnumTypes" Foreground="#267f99" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodDeclaration" Foreground="#795E26" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.MethodCall" Foreground="#795E26" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldDeclaration" Foreground="#001080" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.FieldAccess" Foreground="#001080" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyDeclaration" Foreground="#001080" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.PropertyAccess" Foreground="#001080" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventDeclaration" Foreground="#001080" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.EventAccess" Foreground="#001080" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Variable" Foreground="#001080" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.Parameter" Foreground="#001080" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.InactiveCode" Foreground="#767676" />
<themes:SyntaxColor x:Key="SyntaxColor.C#.SemanticError" Foreground="#cd3131" />
<!-- XML -->
<themes:SyntaxColor x:Key="SyntaxColor.XML.Comment" Foreground="#008000" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.CData" Foreground="#800000" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.DocType" Foreground="#800000" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlDeclaration" Foreground="#800000" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.XmlTag" Foreground="#800000" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeName" Foreground="#e50000" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.AttributeValue" Foreground="#0000ff" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.Entity" Foreground="#098658" />
<themes:SyntaxColor x:Key="SyntaxColor.XML.BrokenEntity" Foreground="#cd3131" />
</ResourceDictionary>

84
ILSpy/Themes/ThemeManager.cs

@ -16,36 +16,46 @@ @@ -16,36 +16,46 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.AvalonEdit.Highlighting;
namespace ICSharpCode.ILSpy.Themes
{
internal class ThemeManager
public class ThemeManager
{
private bool _isDarkMode;
private readonly ResourceDictionary _themeDictionaryContainer = new ResourceDictionary();
private string? _theme;
private readonly ResourceDictionary _themeDictionaryContainer = new();
private readonly Dictionary<string, SyntaxColor> _syntaxColors = new();
public static readonly ThemeManager Current = new ThemeManager();
public static readonly ThemeManager Current = new();
private ThemeManager()
{
Application.Current.Resources.MergedDictionaries.Add(_themeDictionaryContainer);
}
public bool IsDarkMode {
get => _isDarkMode;
set {
_isDarkMode = value;
public string DefaultTheme => "Light";
_themeDictionaryContainer.MergedDictionaries.Clear();
public static IReadOnlyCollection<string> AllThemes => new[] {
"Light",
"Dark",
"VS Code Light+",
"VS Code Dark+",
"R# Light",
"R# Dark"
};
string theme = value ? "Dark" : "Light";
_themeDictionaryContainer.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri($"themes/{theme}Theme.xaml", UriKind.Relative) });
}
public string? Theme {
get => _theme;
set => UpdateTheme(value);
}
public Button CreateButton()
@ -64,5 +74,51 @@ namespace ICSharpCode.ILSpy.Themes @@ -64,5 +74,51 @@ namespace ICSharpCode.ILSpy.Themes
{
return new Style(typeof(Button), (Style)Application.Current.FindResource(ToolBar.ButtonStyleKey));
}
public void ApplyHighlightingColors(IHighlightingDefinition highlightingDefinition)
{
// Make sure all color values are taken from the theme
foreach (var color in highlightingDefinition.NamedHighlightingColors)
SyntaxColor.ResetColor(color);
var prefix = $"SyntaxColor.{highlightingDefinition.Name}.";
foreach (var (key, syntaxColor) in _syntaxColors)
{
var color = highlightingDefinition.GetNamedColor(key.Substring(prefix.Length));
if (color is not null)
syntaxColor.ApplyTo(color);
}
}
private void UpdateTheme(string? themeName)
{
_theme = themeName ?? DefaultTheme;
if (!AllThemes.Contains(_theme))
_theme = DefaultTheme;
var themeFileName = _theme
.Replace("+", "Plus")
.Replace("#", "Sharp")
.Replace(" ", "");
_themeDictionaryContainer.MergedDictionaries.Clear();
_themeDictionaryContainer.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri($"themes/Theme.{themeFileName}.xaml", UriKind.Relative) });
_syntaxColors.Clear();
ProcessDictionary(_themeDictionaryContainer);
void ProcessDictionary(ResourceDictionary resourceDictionary)
{
foreach (DictionaryEntry entry in resourceDictionary)
{
if (entry is { Key: string key, Value: SyntaxColor syntaxColor })
_syntaxColors.TryAdd(key, syntaxColor);
}
foreach (ResourceDictionary mergedDictionary in resourceDictionary.MergedDictionaries)
ProcessDictionary(mergedDictionary);
}
}
}
}

Loading…
Cancel
Save