Browse Source

Rename theme files

pull/2906/head
Lucas Trzesniewski 2 years ago
parent
commit
2599c6b00e
  1. 0
      ILSpy/Themes/Theme.Dark.xaml
  2. 0
      ILSpy/Themes/Theme.Light.xaml
  3. 2
      ILSpy/Themes/Theme.VSCodeLightPlus.xaml
  4. 21
      ILSpy/Themes/ThemeManager.cs

0
ILSpy/Themes/DarkTheme.xaml → ILSpy/Themes/Theme.Dark.xaml

0
ILSpy/Themes/LightTheme.xaml → ILSpy/Themes/Theme.Light.xaml

2
ILSpy/Themes/VSLightTheme.xaml → ILSpy/Themes/Theme.VSCodeLightPlus.xaml

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="LightTheme.xaml" />
<ResourceDictionary Source="Theme.Light.xaml" />
</ResourceDictionary.MergedDictionaries>
<!--

21
ILSpy/Themes/ThemeManager.cs

@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
@ -46,15 +47,12 @@ namespace ICSharpCode.ILSpy.Themes @@ -46,15 +47,12 @@ namespace ICSharpCode.ILSpy.Themes
public static IReadOnlyCollection<string> AllThemes => new[] {
"Dark",
"Light",
"VS Light"
"VS Code Light+"
};
public string? Theme {
get => _theme;
set {
_theme = value;
UpdateTheme();
}
set => UpdateTheme(value);
}
public Button CreateButton()
@ -86,10 +84,19 @@ namespace ICSharpCode.ILSpy.Themes @@ -86,10 +84,19 @@ namespace ICSharpCode.ILSpy.Themes
}
}
private void UpdateTheme()
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 ?? DefaultTheme).Replace(" ", "")}Theme.xaml", UriKind.Relative) });
_themeDictionaryContainer.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri($"themes/Theme.{themeFileName}.xaml", UriKind.Relative) });
_syntaxColors.Clear();
ProcessDictionary(_themeDictionaryContainer);

Loading…
Cancel
Save