Fix textviewer highlighting

This commit is contained in:
Paddy Xu
2022-11-23 20:38:53 +01:00
parent b80c264cdf
commit 7b5b01a7b4
5 changed files with 9 additions and 7 deletions

View File

@@ -128,7 +128,7 @@ namespace QuickLook.Plugin.TextViewer
if (!Directory.Exists(syntaxPath)) if (!Directory.Exists(syntaxPath))
return hlm; return hlm;
foreach (var file in Directory.EnumerateFiles(syntaxPath, "*.xshd")) foreach (var file in Directory.EnumerateFiles(syntaxPath, "*.xshd").OrderBy(f => f))
{ {
Debug.WriteLine(file); Debug.WriteLine(file);
var ext = Path.GetFileNameWithoutExtension(file); var ext = Path.GetFileNameWithoutExtension(file);
@@ -146,7 +146,8 @@ namespace QuickLook.Plugin.TextViewer
} }
private void AssignHighlightingManager(TextViewerPanel tvp, ContextObject context) private void AssignHighlightingManager(TextViewerPanel tvp, ContextObject context)
{ {
var isDark = (context.Theme == Themes.Dark) | OSThemeHelper.AppsUseDarkTheme() | false; var darkThemeAllowed = SettingHelper.Get("AllowDarkTheme", false, "QuickLook.Plugin.TextViewer");
var isDark = darkThemeAllowed && OSThemeHelper.AppsUseDarkTheme();
tvp.HighlightingManager = isDark ? _hlmDark : _hlmLight; tvp.HighlightingManager = isDark ? _hlmDark : _hlmLight;
} }
} }

View File

@@ -89,7 +89,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Syntax\**"> <Content Include="Syntax\**">
<CopyToOutputDirectory>None</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<None Include="app.config" /> <None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />

View File

@@ -45,8 +45,9 @@ namespace QuickLook.Plugin.TextViewer
{ {
_context = context; _context = context;
SetResourceReference(Control.ForegroundProperty, "WindowTextForeground"); Background = OSThemeHelper.AppsUseDarkTheme()
Background = Brushes.Transparent; ? new SolidColorBrush(Color.FromArgb(150, 255, 255, 255))
: Brushes.Transparent;
FontSize = 14; FontSize = 14;
ShowLineNumbers = true; ShowLineNumbers = true;
WordWrap = true; WordWrap = true;

View File

@@ -24,11 +24,11 @@ if(-not (Test-Path env:CI))
Update-Version("..\Build\Appx\AppxManifest.xml") Update-Version("..\Build\Appx\AppxManifest.xml")
# generate resources # generate resources
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makepri.exe' $priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\makepri.exe'
.$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri .$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri
# packing # packing
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe' $packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\makeappx.exe'
$folder = '..\Build\Appx\' $folder = '..\Build\Appx\'
.$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx .$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx