Browse Source

Introduce Dark Mode

pull/2334/head
tom-englert 4 years ago
parent
commit
79a5c5d039
  1. 8
      ILSpy/App.xaml
  2. 4
      ILSpy/App.xaml.cs
  3. 2
      ILSpy/Controls/ResourceObjectTable.xaml
  4. 2
      ILSpy/Controls/ResourceStringTable.xaml
  5. 5
      ILSpy/Controls/SearchBoxStyle.xaml
  6. 12
      ILSpy/ILSpy.csproj
  7. BIN
      ILSpy/Images/DarkMode.png
  8. 31
      ILSpy/MainWindow.xaml
  9. 7
      ILSpy/MainWindow.xaml.cs
  10. 2
      ILSpy/Metadata/MetadataTableViews.xaml
  11. 2
      ILSpy/Options/DecompilerSettingsPanel.xaml
  12. 2
      ILSpy/Options/DisplaySettingsPanel.xaml
  13. 9
      ILSpy/Properties/Resources.Designer.cs
  14. 3
      ILSpy/Properties/Resources.resx
  15. 10
      ILSpy/SessionSettings.cs
  16. 1211
      ILSpy/TextView/Asm-Mode-Dark.xshd
  17. 149
      ILSpy/TextView/CSharp-Mode-Dark.xshd
  18. 73
      ILSpy/TextView/DecompilerTextView.cs
  19. 530
      ILSpy/TextView/ILAsm-Mode-Dark.xshd
  20. 33
      ILSpy/ThemeManager.cs
  21. 31
      ILSpy/themes/DarkTheme.xaml
  22. 4
      SharpTreeView/ICSharpCode.TreeView.csproj
  23. 24
      SharpTreeView/Themes/Generic.xaml

8
ILSpy/App.xaml

@ -1,17 +1,19 @@ @@ -1,17 +1,19 @@
<Application x:Class="ICSharpCode.ILSpy.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:styles="urn:TomsToolbox.Wpf.Styles"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style x:Key="DialogWindow" TargetType="{x:Type Window}">
<Style x:Key="DialogWindow" TargetType="{x:Type Window}" BasedOn="{StaticResource {x:Static styles:ResourceKeys.WindowStyle}}">
<Setter Property="ShowInTaskbar" Value="False"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
</Style>
<Style TargetType="{x:Type Button}">
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static styles:ResourceKeys.ButtonStyle}}">
<Setter Property="MinWidth" Value="73" />
<Setter Property="Padding" Value="9,1,9,1" />
</Style>
</Application.Resources>
</Application>

4
ILSpy/App.xaml.cs

@ -33,6 +33,8 @@ using ICSharpCode.ILSpy.Options; @@ -33,6 +33,8 @@ using ICSharpCode.ILSpy.Options;
using Microsoft.VisualStudio.Composition;
using TomsToolbox.Wpf.Styles;
namespace ICSharpCode.ILSpy
{
/// <summary>
@ -67,6 +69,8 @@ namespace ICSharpCode.ILSpy @@ -67,6 +69,8 @@ namespace ICSharpCode.ILSpy
}
InitializeComponent();
Resources.RegisterDefault();
if (!System.Diagnostics.Debugger.IsAttached)
{
AppDomain.CurrentDomain.UnhandledException += ShowErrorBox;

2
ILSpy/Controls/ResourceObjectTable.xaml

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
<SolidColorBrush Color="Beige"></SolidColorBrush>
</AlternationConverter>
<Style x:Key="alternatingWithBinding"
TargetType="{x:Type ListBoxItem}">
TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="Background"
Value="{Binding RelativeSource={RelativeSource Self},
Path=(ItemsControl.AlternationIndex),

2
ILSpy/Controls/ResourceStringTable.xaml

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
<SolidColorBrush Color="Beige"></SolidColorBrush>
</AlternationConverter>
<Style x:Key="alternatingWithBinding"
TargetType="{x:Type ListBoxItem}">
TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="Background"
Value="{Binding RelativeSource={RelativeSource Self},
Path=(ItemsControl.AlternationIndex),

5
ILSpy/Controls/SearchBoxStyle.xaml

@ -2,10 +2,7 @@ @@ -2,10 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.ILSpy.Controls">
<Style x:Key="{x:Type local:SearchBox}" TargetType="{x:Type local:SearchBox}">
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Style x:Key="{x:Type local:SearchBox}" TargetType="{x:Type local:SearchBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>

12
ILSpy/ILSpy.csproj

@ -54,13 +54,14 @@ @@ -54,13 +54,14 @@
<PackageReference Include="AvalonEdit" Version="$(AvalonEditVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemCompilerServicesUnsafeVersion)" />
<PackageReference Include="Dirkster.AvalonDock" Version="4.50.1" />
<PackageReference Include="Dirkster.AvalonDock.Themes.VS2013" Version="4.50.1" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.9.6-alpha" />
<PackageReference Include="System.Composition" Version="$(SystemCompositionVersion)" />
<PackageReference Include="Mono.Cecil" Version="$(MonoCecilVersion)" />
<PackageReference Include="OSVersionHelper" Version="1.1.24" />
<PackageReference Include="DataGridExtensions" Version="2.5.1" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
<PackageReference Include="TomsToolbox.Wpf.Styles" Version="2.4.0" />
</ItemGroup>
<ItemGroup>
@ -216,6 +217,7 @@ @@ -216,6 +217,7 @@
<Compile Include="Metadata\MetadataProtocolHandler.cs" />
<Compile Include="Metadata\MetadataTableTreeNode.cs" />
<Compile Include="Metadata\DebugMetadataTreeNode.cs" />
<Compile Include="ThemeManager.cs" />
<Compile Include="TreeNodes\PackageFolderTreeNode.cs" />
<Compile Include="ViewModels\LegacyToolPaneModel.cs" />
<Compile Include="ViewModels\ManageAssemblyListsViewModel.cs" />
@ -471,6 +473,9 @@ @@ -471,6 +473,9 @@
<EmbeddedResource Include="TextView\CSharp-Mode.xshd" />
<EmbeddedResource Include="TextView\ILAsm-Mode.xshd" />
<EmbeddedResource Include="TextView\Asm-Mode.xshd" />
<EmbeddedResource Include="TextView\CSharp-Mode-Dark.xshd" />
<EmbeddedResource Include="TextView\ILAsm-Mode-Dark.xshd" />
<EmbeddedResource Include="TextView\Asm-Mode-Dark.xshd" />
<None Include="app.config" />
<None Include="app.manifest" />
<None Include="Properties\app.config.template" />
@ -511,6 +516,7 @@ @@ -511,6 +516,7 @@
<Page Include="Controls\ResourceObjectTable.xaml" />
<Page Include="Controls\ResourceStringTable.xaml" />
<Page Include="Controls\SearchBoxStyle.xaml" />
<Page Include="themes\DarkTheme.xaml" />
<Page Include="Metadata\FlagsFilterControl.xaml" />
<Page Include="Metadata\FlagsTooltip.xaml" />
<Page Include="Metadata\HexFilterControl.xaml" />
@ -593,6 +599,9 @@ @@ -593,6 +599,9 @@
<ItemGroup>
<Page Update="@(Page)" SubType="Designer" Generator="MSBuild:Compile" />
<Page Update="themes\DarkTheme.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Metadata\FlagsFilterControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
@ -855,6 +864,7 @@ @@ -855,6 +864,7 @@
<ItemGroup>
<Resource Include="Images\NuGet.png" />
<Resource Include="Images\DarkMode.png" />
</ItemGroup>
<Target Name="SortResX" BeforeTargets="BeforeBuild" Inputs="@(SortResXInput)" Outputs="@(SortResXStamp)">

BIN
ILSpy/Images/DarkMode.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

31
ILSpy/MainWindow.xaml

@ -18,6 +18,8 @@ @@ -18,6 +18,8 @@
TextOptions.TextFormattingMode="Display"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" d:DesignHeight="500" d:DesignWidth="500"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
xmlns:styles="urn:TomsToolbox.Wpf.Styles"
d:DataContext="{d:DesignInstance local:MainWindowDataContext}"
>
<Window.Resources>
<controls:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
@ -56,6 +58,9 @@ @@ -56,6 +58,9 @@
<DataTemplate x:Key="DefaultContentTemplate">
<ContentPresenter Content="{Binding Content}" />
</DataTemplate>
<styles:InvertGrayEffect x:Key="InvertGrayEffect" />
</Window.Resources>
<Window.CommandBindings>
@ -114,6 +119,20 @@ @@ -114,6 +119,20 @@
</DataTrigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type Image}" x:Key="DarkModeAwareImageStyle">
<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>
<!-- 'Navigation' toolbar category is inserted here -->
<Separator />
@ -123,17 +142,17 @@ @@ -123,17 +142,17 @@
ItemsSource="{Binding AssemblyListManager.AssemblyLists}" ToolTip="{x:Static properties:Resources.SelectAssemblyListDropdownTooltip}"
SelectedItem="{Binding SessionSettings.ActiveAssemblyList}"/>
<Button Command="{x:Static local:ILSpyCommands.ManageAssemblyListsCommand}" ToolTip="{x:Static properties:Resources.ManageAssemblyLists}">
<Image Width="16" Height="16" Source="{controls:XamlResource Images/AssemblyList}" />
<Image Width="16" Height="16" Source="{controls:XamlResource Images/AssemblyList}" Style="{StaticResource DarkModeAwareImageStyle}"/>
</Button>
<Separator />
<CheckBox IsChecked="{Binding SessionSettings.FilterSettings.ApiVisPublicOnly}" ToolTip="{x:Static properties:Resources.ShowPublicOnlyTypesMembers}">
<Image Width="16" Height="16" Source="{controls:XamlResource Images/ShowPublicOnly}" />
<Image Width="16" Height="16" Source="{controls:XamlResource Images/ShowPublicOnly}" Style="{StaticResource DarkModeAwareImageStyle}"/>
</CheckBox>
<CheckBox IsChecked="{Binding SessionSettings.FilterSettings.ApiVisPublicAndInternal}" ToolTip="{x:Static properties:Resources.ShowInternalTypesMembers}">
<Image Width="16" Height="16" Source="{controls:XamlResource Images/ShowPrivateInternal}" />
<Image Width="16" Height="16" Source="{controls:XamlResource Images/ShowPrivateInternal}" Style="{StaticResource DarkModeAwareImageStyle}"/>
</CheckBox>
<CheckBox IsChecked="{Binding SessionSettings.FilterSettings.ApiVisAll}" ToolTip="{x:Static properties:Resources.ShowAllTypesAndMembers}">
<Image Width="16" Height="16" Source="{controls:XamlResource Images/ShowAll}" />
<Image Width="16" Height="16" Source="{controls:XamlResource Images/ShowAll}" Style="{StaticResource DarkModeAwareImageStyle}"/>
</CheckBox>
<Separator />
<ComboBox Name="languageComboBox" DisplayMemberPath="Name" Width="100" MaxDropDownHeight="Auto"
@ -145,6 +164,10 @@ @@ -145,6 +164,10 @@
IsEnabled="{Binding ActiveTabPage.SupportsLanguageSwitching, Source={x:Static docking:DockWorkspace.Instance}}"
ItemsSource="{Binding SelectedItem.LanguageVersions, ElementName=languageComboBox, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SessionSettings.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>
</ToolBar>
<Border DockPanel.Dock="Top" BorderBrush="Black" BorderThickness="1" Name="updatePanel" Visibility="Collapsed">
<DockPanel KeyboardNavigation.TabNavigation="Contained">

7
ILSpy/MainWindow.xaml.cs

@ -142,6 +142,13 @@ namespace ICSharpCode.ILSpy @@ -142,6 +142,13 @@ namespace ICSharpCode.ILSpy
{
ShowAssemblyList(sessionSettings.ActiveAssemblyList);
}
if (e.PropertyName == nameof(SessionSettings.IsDarkMode))
{
// update syntax highlighting and force reload (AvalonEdit does not automatically refresh on highlighting change)
DecompilerTextView.RegisterHighlighting();
DecompileSelectedNodes(DockWorkspace.Instance.ActiveTabPage.GetState() as DecompilerTextViewState);
}
}
void SetWindowBounds(Rect bounds)

2
ILSpy/Metadata/MetadataTableViews.xaml

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
xmlns:srm="clr-namespace:System.Reflection;assembly=System.Reflection.Metadata"
xmlns:dgx="urn:tom-englert.de/DataGridExtensions">
<Style x:Key="DataGridCellStyle" TargetType="{x:Type DataGridCell}">
<Style x:Key="DataGridCellStyle" TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="2" />
<Setter Property="VerticalContentAlignment" Value="Center" />

2
ILSpy/Options/DecompilerSettingsPanel.xaml

@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
</ItemsPanelTemplate>
</GroupStyle.Panel>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Style TargetType="{x:Type GroupItem}" BasedOn="{StaticResource {x:Type GroupItem}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>

2
ILSpy/Options/DisplaySettingsPanel.xaml

@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
<ComboBoxItem>23</ComboBoxItem>
<ComboBoxItem>24</ComboBoxItem>
</ComboBox>
<Border Grid.Row="1" Grid.ColumnSpan="4" BorderBrush="Black" BorderThickness="1" Background="White" Margin="3,5">
<Border Grid.Row="1" Grid.ColumnSpan="4" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" BorderThickness="1" Margin="3,5">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="AaBbCcXxYyZz" FontFamily="{Binding SelectedFont}" FontSize="{Binding SelectedFontSize}" />
</Border>
</Grid>

9
ILSpy/Properties/Resources.Designer.cs generated

@ -540,6 +540,15 @@ namespace ICSharpCode.ILSpy.Properties { @@ -540,6 +540,15 @@ 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>

3
ILSpy/Properties/Resources.resx

@ -219,6 +219,9 @@ Are you sure you want to continue?</value> @@ -219,6 +219,9 @@ 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>

10
ILSpy/SessionSettings.cs

@ -61,6 +61,7 @@ namespace ICSharpCode.ILSpy @@ -61,6 +61,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.DockLayout = new DockLayoutSettings(doc.Element("DockLayout"));
}
@ -75,6 +76,14 @@ namespace ICSharpCode.ILSpy @@ -75,6 +76,14 @@ namespace ICSharpCode.ILSpy
public FilterSettings FilterSettings { get; private set; }
public SearchMode SelectedSearchMode { get; set; }
public bool IsDarkMode {
get => ThemeManager.Current.IsDarkMode;
set {
ThemeManager.Current.IsDarkMode = value;
OnPropertyChanged();
}
}
public string[] ActiveTreeViewPath;
public string ActiveAutoLoadedAssembly;
@ -122,6 +131,7 @@ namespace ICSharpCode.ILSpy @@ -122,6 +131,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)));
var dockLayoutElement = new XElement("DockLayout");
if (DockLayout.Valid)

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

File diff suppressed because it is too large Load Diff

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

@ -0,0 +1,149 @@ @@ -0,0 +1,149 @@
<?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="Navy" exampleText="[assembly: AssemblyVersion(&quot;1.0.0.*&quot;)]" />
<!-- Colors used for semantic highlighting -->
<Color name="ReferenceTypes" foreground="#004085" exampleText="System.#{#Uri#}# uri;"/>
<Color name="InterfaceTypes" foreground="#004085" exampleText="System.#{#IDisposable#}# obj;"/>
<Color name="TypeParameters" foreground="#004085" exampleText="class MyList&lt;#{#T#}#&gt; { }"/>
<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="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>

73
ILSpy/TextView/DecompilerTextView.cs

@ -87,41 +87,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -87,41 +87,7 @@ namespace ICSharpCode.ILSpy.TextView
#region Constructor
public DecompilerTextView()
{
HighlightingManager.Instance.RegisterHighlighting(
"ILAsm", new string[] { ".il" },
delegate {
using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "ILAsm-Mode.xshd"))
{
using (XmlTextReader reader = new XmlTextReader(s))
{
return HighlightingLoader.Load(reader, HighlightingManager.Instance);
}
}
});
HighlightingManager.Instance.RegisterHighlighting(
"C#", new string[] { ".cs" },
delegate {
using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "CSharp-Mode.xshd"))
{
using (XmlTextReader reader = new XmlTextReader(s))
{
return HighlightingLoader.Load(reader, HighlightingManager.Instance);
}
}
});
HighlightingManager.Instance.RegisterHighlighting(
"Asm", new string[] { ".s", ".asm" },
delegate {
using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "Asm-Mode.xshd"))
{
using (XmlTextReader reader = new XmlTextReader(s))
{
return HighlightingLoader.Load(reader, HighlightingManager.Instance);
}
}
});
RegisterHighlighting();
InitializeComponent();
@ -1190,6 +1156,14 @@ namespace ICSharpCode.ILSpy.TextView @@ -1190,6 +1156,14 @@ namespace ICSharpCode.ILSpy.TextView
ViewState IHaveState.GetState() => GetState();
public static void RegisterHighlighting()
{
HighlightingManager.Instance.RegisterHighlighting("ILAsm", new[] { ".il" }, "ILAsm-Mode");
HighlightingManager.Instance.RegisterHighlighting("C#", new[] { ".cs" }, "CSharp-Mode");
HighlightingManager.Instance.RegisterHighlighting("Asm", new[] { ".s", ".asm" }, "Asm-Mode");
}
public void Dispose()
{
DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged -= CurrentDisplaySettings_PropertyChanged;
@ -1274,4 +1248,33 @@ namespace ICSharpCode.ILSpy.TextView @@ -1274,4 +1248,33 @@ namespace ICSharpCode.ILSpy.TextView
return false;
}
}
static class ExtensionMethods
{
public static void RegisterHighlighting(
this HighlightingManager manager,
string name,
string[] extensions,
string resourceName)
{
if (ThemeManager.Current.IsDarkMode)
{
resourceName += "-Dark";
}
resourceName += ".xshd";
manager.RegisterHighlighting(
name, extensions,
delegate {
using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), resourceName))
{
using (XmlTextReader reader = new XmlTextReader(s))
{
return HighlightingLoader.Load(reader, manager);
}
}
});
}
}
}

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

@ -0,0 +1,530 @@ @@ -0,0 +1,530 @@
<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>
</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>#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>
</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>

33
ILSpy/ThemeManager.cs

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
using System;
using System.Windows;
namespace ICSharpCode.ILSpy
{
internal class ThemeManager
{
private bool _isDarkMode;
private readonly ResourceDictionary _themeDictionaryContainer = new ResourceDictionary();
public static readonly ThemeManager Current = new ThemeManager();
private ThemeManager()
{
Application.Current.Resources.MergedDictionaries.Add(_themeDictionaryContainer);
}
public bool IsDarkMode {
get => _isDarkMode;
set {
_isDarkMode = value;
_themeDictionaryContainer.MergedDictionaries.Clear();
if (value)
{
_themeDictionaryContainer.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri("themes/DarkTheme.xaml", UriKind.Relative) });
}
}
}
}
}

31
ILSpy/themes/DarkTheme.xaml

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:styles="urn:TomsToolbox.Wpf.Styles">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/AvalonDock.Themes.VS2013;component/darktheme.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlLightLightBrushKey}" Color="#333337" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlLightBrushKey}" Color="#464646" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#252526" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkBrushKey}" Color="#686868" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#9E9E9E" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="#F1F1F1" />
<SolidColorBrush x:Key="{x:Static SystemColors.GrayTextBrushKey}" Color="#999999" />
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#3399FF" />
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#FFFFFF" />
<SolidColorBrush x:Key="{x:Static SystemColors.InfoTextBrushKey}" Color="#F1F1F1" />
<SolidColorBrush x:Key="{x:Static SystemColors.InfoBrushKey}" Color="#252526" />
<SolidColorBrush x:Key="{x:Static SystemColors.MenuBrushKey}" Color="#1B1B1C" />
<SolidColorBrush x:Key="{x:Static SystemColors.MenuBarBrushKey}" Color="#1B1B1C" />
<SolidColorBrush x:Key="{x:Static SystemColors.MenuTextBrushKey}" Color="#F1F1F1" />
<SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="#333337" />
<SolidColorBrush x:Key="{x:Static SystemColors.WindowTextBrushKey}" Color="#F1F1F1" />
<SolidColorBrush x:Key="{x:Static SystemColors.ActiveCaptionBrushKey}" Color="#2D2D30" />
<SolidColorBrush x:Key="{x:Static SystemColors.ActiveBorderBrushKey}" Color="#007ACC" />
<SolidColorBrush x:Key="{x:Static SystemColors.ActiveCaptionTextBrushKey}" Color="#F1F1F1" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveCaptionBrushKey}" Color="#2D2D30" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveBorderBrushKey}" Color="#434346" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveCaptionTextBrushKey}" Color="#F1F1F1" />
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.BorderBrush}" Color="#3F3F46" />
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.DisabledBrush}" Color="#2D2D30" />
</ResourceDictionary>

4
SharpTreeView/ICSharpCode.TreeView.csproj

@ -64,4 +64,8 @@ @@ -64,4 +64,8 @@
<Compile Include="TreeTraversal.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="TomsToolbox.Wpf.Styles" Version="2.4.0" />
</ItemGroup>
</Project>

24
SharpTreeView/Themes/Generic.xaml

@ -1,12 +1,10 @@ @@ -1,12 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Default="clr-namespace:ICSharpCode.TreeView">
<SolidColorBrush x:Key="ListBorder"
Color="#FF7F9DB9" />
xmlns:Default="clr-namespace:ICSharpCode.TreeView"
xmlns:styles="urn:TomsToolbox.Wpf.Styles">
<Style x:Key="ExpandCollapseToggleStyle"
TargetType="{x:Type ToggleButton}">
TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Focusable"
Value="False" />
<Setter Property="Template">
@ -15,7 +13,7 @@ @@ -15,7 +13,7 @@
<Border Width="9"
Height="9"
BorderThickness="1"
BorderBrush="#FF7898B5"
BorderBrush="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"
CornerRadius="1"
SnapsToDevicePixels="True">
<Border.Background>
@ -85,7 +83,7 @@ @@ -85,7 +83,7 @@
<ControlTemplate TargetType="{x:Type Default:EditTextBox}">
<Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
BorderThickness="1"
BorderBrush="{StaticResource ListBorder}"
BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"
Padding="0 1 2 0">
<ScrollViewer Name="PART_ContentHost" />
</Border>
@ -95,7 +93,7 @@ @@ -95,7 +93,7 @@
</Style>
<Style TargetType="{x:Type Default:SharpTreeView}"
BasedOn="{StaticResource {x:Type ListBox}}">
BasedOn="{StaticResource {x:Static styles:ResourceKeys.ListBoxStyle}}">
<Style.Triggers>
<Trigger Property="ShowRoot"
Value="False">
@ -116,13 +114,13 @@ @@ -116,13 +114,13 @@
Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Background"
Value="WhiteSmoke" />
Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<Style x:Key="{x:Static Default:SharpGridView.ItemContainerStyleKey}"
TargetType="{x:Type ListViewItem}">
TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource {x:Type ListViewItem}}">
<Setter Property="Background"
Value="Transparent" />
<Setter Property="VerticalContentAlignment"
@ -180,8 +178,8 @@ @@ -180,8 +178,8 @@
<ControlTemplate TargetType="{x:Type Default:SharpTreeViewItem}">
<Border Background="Transparent">
<Border Background="{TemplateBinding Background}">
<Default:SharpTreeNodeView Name="nodeView"
Foreground="{Binding Foreground}"
<Default:SharpTreeNodeView x:Name="nodeView"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="Left" />
</Border>
</Border>
@ -228,7 +226,7 @@ @@ -228,7 +226,7 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type Default:SharpTreeNodeView}">
<Grid>
<Default:LinesRenderer Name="linesRenderer"
<Default:LinesRenderer x:Name="linesRenderer"
ClipToBounds="True"
Visibility="{Binding ShowLines, RelativeSource={RelativeSource AncestorType={x:Type Default:SharpTreeView}}, Converter={Default:CollapsedWhenFalse}}" />
<StackPanel Orientation="Horizontal">

Loading…
Cancel
Save