mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
Global dark theme
This commit is contained in:
@@ -37,7 +37,7 @@ namespace QuickLook.Common.Plugin
|
|||||||
private bool _titlebarBlurVisibility;
|
private bool _titlebarBlurVisibility;
|
||||||
private bool _titlebarColourVisibility = true;
|
private bool _titlebarColourVisibility = true;
|
||||||
private bool _titlebarOverlap;
|
private bool _titlebarOverlap;
|
||||||
private bool _useDarkTheme;
|
private Themes _theme = Themes.None;
|
||||||
private object _viewerContent;
|
private object _viewerContent;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -168,12 +168,12 @@ namespace QuickLook.Common.Plugin
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Switch to dark theme?
|
/// Switch to dark theme?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UseDarkTheme
|
public Themes Theme
|
||||||
{
|
{
|
||||||
get => _useDarkTheme;
|
get => _theme;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_useDarkTheme = value;
|
_theme = value;
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ namespace QuickLook.Common.Plugin
|
|||||||
CanResize = true;
|
CanResize = true;
|
||||||
FullWindowDragging = false;
|
FullWindowDragging = false;
|
||||||
|
|
||||||
UseDarkTheme = false;
|
Theme = Themes.None;
|
||||||
TitlebarOverlap = false;
|
TitlebarOverlap = false;
|
||||||
TitlebarAutoHide = false;
|
TitlebarAutoHide = false;
|
||||||
TitlebarBlurVisibility = false;
|
TitlebarBlurVisibility = false;
|
||||||
|
26
QuickLook.Common/Plugin/Themes.cs
Normal file
26
QuickLook.Common/Plugin/Themes.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// Copyright © 2018 Paddy Xu
|
||||||
|
//
|
||||||
|
// This file is part of QuickLook program.
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
namespace QuickLook.Common.Plugin
|
||||||
|
{
|
||||||
|
public enum Themes
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Dark,
|
||||||
|
Light
|
||||||
|
}
|
||||||
|
}
|
@@ -57,6 +57,7 @@
|
|||||||
<Compile Include="Plugin\IViewer.cs" />
|
<Compile Include="Plugin\IViewer.cs" />
|
||||||
<Compile Include="NativeMethods\Kernel32.cs" />
|
<Compile Include="NativeMethods\Kernel32.cs" />
|
||||||
<Compile Include="Helpers\ProcessHelper.cs" />
|
<Compile Include="Helpers\ProcessHelper.cs" />
|
||||||
|
<Compile Include="Plugin\Themes.cs" />
|
||||||
<Compile Include="Properties\Annotations.cs" />
|
<Compile Include="Properties\Annotations.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Helpers\SettingHelper.cs" />
|
<Compile Include="Helpers\SettingHelper.cs" />
|
||||||
@@ -64,6 +65,19 @@
|
|||||||
<Compile Include="NativeMethods\User32.cs" />
|
<Compile Include="NativeMethods\User32.cs" />
|
||||||
<Compile Include="Helpers\WindowHelper.cs" />
|
<Compile Include="Helpers\WindowHelper.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Page Include="Styles\MainWindowStyles.Dark.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Styles\MainWindowStyles.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Styles\ScrollBarStyleDictionary.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
@@ -98,7 +98,7 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Border Grid.RowSpan="3" CornerRadius="2" Background="#F0F0F0" />
|
<Border Grid.RowSpan="3" CornerRadius="2" Background="Transparent" />
|
||||||
<Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="true">
|
<Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="true">
|
||||||
<Track.DecreaseRepeatButton>
|
<Track.DecreaseRepeatButton>
|
||||||
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
|
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
<Border
|
<Border
|
||||||
Grid.ColumnSpan="3"
|
Grid.ColumnSpan="3"
|
||||||
CornerRadius="2"
|
CornerRadius="2"
|
||||||
Background="#F0F0F0" />
|
Background="Transparent" />
|
||||||
<Track
|
<Track
|
||||||
x:Name="PART_Track"
|
x:Name="PART_Track"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
@@ -130,13 +130,13 @@
|
|||||||
|
|
||||||
<TreeView Grid.Row="1"
|
<TreeView Grid.Row="1"
|
||||||
x:Name="treeView"
|
x:Name="treeView"
|
||||||
BorderThickness="0" Background="Transparent"
|
BorderThickness="0" Background="Transparent" Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=local:ArchiveFileListView}}"
|
||||||
ItemsSource="{Binding}">
|
ItemsSource="{Binding}">
|
||||||
<!--<TreeView.ItemContainerStyle>
|
<TreeView.ItemContainerStyle>
|
||||||
<Style TargetType="{x:Type TreeViewItem}">
|
<Style TargetType="{x:Type TreeViewItem}">
|
||||||
<Setter Property="IsExpanded" Value="{Binding Level, Converter={StaticResource LevelToBooleanConverter}}" />
|
<Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType=TreeView}}" />
|
||||||
</Style>
|
</Style>
|
||||||
</TreeView.ItemContainerStyle>-->
|
</TreeView.ItemContainerStyle>
|
||||||
</TreeView>
|
</TreeView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
@@ -11,7 +11,7 @@
|
|||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<!-- only for design -->
|
<!-- only for design -->
|
||||||
<ResourceDictionary Source="/QuickLook;component/Styles/MainWindowStyles.xaml" />
|
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<local:Percent100ToVisibilityVisibleConverter x:Key="Percent100ToVisibilityVisibleConverter" />
|
<local:Percent100ToVisibilityVisibleConverter x:Key="Percent100ToVisibilityVisibleConverter" />
|
||||||
<local:Percent100ToVisibilityCollapsedConverter x:Key="Percent100ToVisibilityCollapsedConverter" />
|
<local:Percent100ToVisibilityCollapsedConverter x:Key="Percent100ToVisibilityCollapsedConverter" />
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<Grid ZIndex="9999"
|
<Grid ZIndex="9999"
|
||||||
Visibility="{Binding ElementName=infoPanel, Path=LoadPercent, Mode=OneWay, Converter={StaticResource Percent100ToVisibilityCollapsedConverter}}">
|
Visibility="{Binding ElementName=infoPanel, Path=LoadPercent, Mode=OneWay, Converter={StaticResource Percent100ToVisibilityCollapsedConverter}}">
|
||||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
<Label FontSize="14" HorizontalAlignment="Center">Loading archive ...</Label>
|
<Label FontSize="14" HorizontalAlignment="Center" Foreground="{DynamicResource WindowTextForeground}">Loading archive ...</Label>
|
||||||
<ProgressBar Height="13" Width="150"
|
<ProgressBar Height="13" Width="150"
|
||||||
Value="{Binding ElementName=infoPanel, Path=LoadPercent, Mode=OneWay}" />
|
Value="{Binding ElementName=infoPanel, Path=LoadPercent, Mode=OneWay}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -32,16 +32,16 @@
|
|||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<RowDefinition Height="30" />
|
<RowDefinition Height="30" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<local:ArchiveFileListView Grid.Row="0" x:Name="fileListView" Focusable="False" />
|
<local:ArchiveFileListView Grid.Row="0" x:Name="fileListView" Focusable="False" Foreground="{DynamicResource WindowTextForeground}" />
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="40*" />
|
<ColumnDefinition Width="40*" />
|
||||||
<ColumnDefinition Width="30*" />
|
<ColumnDefinition Width="30*" />
|
||||||
<ColumnDefinition Width="30*" />
|
<ColumnDefinition Width="30*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Label x:Name="archiveCount" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">0 folders and 0 files, solid, password-protected</Label>
|
<Label x:Name="archiveCount" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource WindowTextForegroundAlternative}">0 folders and 0 files, solid, password-protected</Label>
|
||||||
<Label x:Name="archiveSizeC" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">Compressed size 0 bytes</Label>
|
<Label x:Name="archiveSizeC" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource WindowTextForegroundAlternative}">Compressed size 0 bytes</Label>
|
||||||
<Label x:Name="archiveSizeU" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">Uncompressed size 0 bytes</Label>
|
<Label x:Name="archiveSizeU" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource WindowTextForegroundAlternative}">Uncompressed size 0 bytes</Label>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<!-- only for design -->
|
<!-- only for design -->
|
||||||
<ResourceDictionary Source="/QuickLook;component/Styles/MainWindowStyles.xaml" />
|
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
|
||||||
<ResourceDictionary Source="/QuickLook;component/Styles/MainWindowStyles.Dark.xaml" />
|
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.Dark.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
@@ -64,7 +64,7 @@ namespace QuickLook.Plugin.ImageViewer
|
|||||||
else
|
else
|
||||||
context.PreferredSize = new Size(800, 600);
|
context.PreferredSize = new Size(800, 600);
|
||||||
|
|
||||||
context.UseDarkTheme = true;
|
context.Theme = Themes.Dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void View(string path, ContextObject context)
|
public void View(string path, ContextObject context)
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
|
||||||
<ResourceDictionary Source="ListBoxItemStyleNoFocusedBorder.xaml" />
|
<ResourceDictionary Source="ListBoxItemStyleNoFocusedBorder.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -26,9 +27,9 @@
|
|||||||
VirtualizingPanel.IsVirtualizing="True" Width="150"
|
VirtualizingPanel.IsVirtualizing="True" Width="150"
|
||||||
SelectedIndex="0"
|
SelectedIndex="0"
|
||||||
Focusable="False"
|
Focusable="False"
|
||||||
Background="Transparent"
|
Background="Transparent" BorderThickness="0"
|
||||||
ItemsSource="{Binding PageThumbnails, ElementName=thisPdfViewer}"
|
ItemsSource="{Binding PageThumbnails, ElementName=thisPdfViewer}"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0,0,1,0"
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
ItemContainerStyle="{Binding Mode=OneWay, Source={StaticResource ListBoxItemStyleNoFocusedBorder}}">
|
ItemContainerStyle="{Binding Mode=OneWay, Source={StaticResource ListBoxItemStyleNoFocusedBorder}}">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="10" />
|
<RowDefinition Height="10" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Border x:Name="bbd" Grid.Row="1" Grid.Column="1" BorderThickness="1" BorderBrush="#FFE1E1E1">
|
<Border x:Name="bbd" Grid.Row="1" Grid.Column="1" BorderThickness="1" BorderBrush="#33FFFFFF">
|
||||||
<Image Source="{Binding}" />
|
<Image Source="{Binding}" />
|
||||||
</Border>
|
</Border>
|
||||||
<!--
|
<!--
|
||||||
@@ -55,13 +56,13 @@
|
|||||||
<DataTrigger
|
<DataTrigger
|
||||||
Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}"
|
Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}"
|
||||||
Value="True">
|
Value="True">
|
||||||
<Setter TargetName="bbd" Property="BorderBrush" Value="#FF0040FF" />
|
<Setter TargetName="bbd" Property="BorderBrush" Value="#DD0027FF" />
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</DataTemplate.Triggers>
|
</DataTemplate.Triggers>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
<Grid Grid.Column="1" Background="#FFFAFAFA">
|
<Grid Grid.Column="1" Background="#33FFFFFF">
|
||||||
<imageViewer:ImagePanel x:Name="pagePanel" RenderMode="NearestNeighbor" ShowZoomLevelInfo="False"
|
<imageViewer:ImagePanel x:Name="pagePanel" RenderMode="NearestNeighbor" ShowZoomLevelInfo="False"
|
||||||
BackgroundVisibility="Collapsed" MetaIconVisibility="Collapsed" />
|
BackgroundVisibility="Collapsed" MetaIconVisibility="Collapsed" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@@ -46,6 +46,9 @@ namespace QuickLook.Plugin.PDFViewer
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
// remove theme used in designer
|
||||||
|
Resources.MergedDictionaries.RemoveAt(0);
|
||||||
|
|
||||||
listThumbnails.SelectionChanged += UpdatePageViewWhenSelectionChanged;
|
listThumbnails.SelectionChanged += UpdatePageViewWhenSelectionChanged;
|
||||||
|
|
||||||
pagePanel.DelayedReRender += ReRenderCurrentPageDelayed;
|
pagePanel.DelayedReRender += ReRenderCurrentPageDelayed;
|
||||||
|
@@ -82,6 +82,8 @@ namespace QuickLook.Plugin.TextViewer
|
|||||||
|
|
||||||
public void Prepare(string path, ContextObject context)
|
public void Prepare(string path, ContextObject context)
|
||||||
{
|
{
|
||||||
|
context.Theme = Themes.Light;
|
||||||
|
|
||||||
context.PreferredSize = new Size {Width = 800, Height = 600};
|
context.PreferredSize = new Size {Width = 800, Height = 600};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -80,7 +80,7 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
context.TitlebarAutoHide = true;
|
context.TitlebarAutoHide = true;
|
||||||
context.UseDarkTheme = true;
|
context.Theme = Themes.Dark;
|
||||||
context.TitlebarBlurVisibility = true;
|
context.TitlebarBlurVisibility = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<!-- only for design -->
|
<!-- only for design -->
|
||||||
<ResourceDictionary Source="/QuickLook;component/Styles/MainWindowStyles.xaml" />
|
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
<Style x:Key="ControlButtonStyle" TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
<Style x:Key="ControlButtonStyle" TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
|
||||||
|
@@ -285,13 +285,10 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
if (CoverArt == null)
|
if (CoverArt == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var dark = false;
|
|
||||||
using (var bitmap = new Bitmap(CoverArt.ToBitmap()))
|
using (var bitmap = new Bitmap(CoverArt.ToBitmap()))
|
||||||
{
|
{
|
||||||
dark = bitmap.IsDarkImage();
|
_context.Theme = bitmap.IsDarkImage() ? Themes.Dark : Themes.Light;
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.UseDarkTheme = dark;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeVolume(double delta)
|
private void ChangeVolume(double delta)
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="Styles/ScrollBarStyleDictionary.xaml" />
|
<ResourceDictionary Source="/QuickLook.Common;component/Styles/ScrollBarStyleDictionary.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<FontFamily x:Key="SegoeMDL2">./Fonts/#Segoe MDL2 Assets</FontFamily>
|
<FontFamily x:Key="SegoeMDL2">./Fonts/#Segoe MDL2 Assets</FontFamily>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="../../Styles/MainWindowStyles.xaml" />
|
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
@@ -153,18 +153,6 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Styles\MainWindowStyles.Dark.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
<Page Include="Styles\MainWindowStyles.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
<Page Include="Styles\ScrollBarStyleDictionary.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
<Page Include="ViewerWindow.xaml">
|
<Page Include="ViewerWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
@@ -19,6 +19,7 @@ using System;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using Microsoft.Win32;
|
||||||
using QuickLook.Common.Annotations;
|
using QuickLook.Common.Annotations;
|
||||||
using QuickLook.Common.Plugin;
|
using QuickLook.Common.Plugin;
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ namespace QuickLook
|
|||||||
{
|
{
|
||||||
private readonly ResourceDictionary _darkDict = new ResourceDictionary
|
private readonly ResourceDictionary _darkDict = new ResourceDictionary
|
||||||
{
|
{
|
||||||
Source = new Uri("pack://application:,,,/QuickLook;component/Styles/MainWindowStyles.Dark.xaml")
|
Source = new Uri("pack://application:,,,/QuickLook.Common;component/Styles/MainWindowStyles.Dark.xaml")
|
||||||
};
|
};
|
||||||
private bool _canOldPluginResize;
|
private bool _canOldPluginResize;
|
||||||
private bool _pinned;
|
private bool _pinned;
|
||||||
@@ -57,17 +58,33 @@ namespace QuickLook
|
|||||||
{
|
{
|
||||||
switch (e.PropertyName)
|
switch (e.PropertyName)
|
||||||
{
|
{
|
||||||
case nameof(ContextObject.UseDarkTheme):
|
case nameof(ContextObject.Theme):
|
||||||
SwitchTheme(ContextObject.UseDarkTheme);
|
SwitchTheme(ContextObject.Theme);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SwitchTheme(bool dark)
|
public void SwitchTheme(Themes theme)
|
||||||
{
|
{
|
||||||
if (dark)
|
var isDark = false;
|
||||||
|
|
||||||
|
switch (theme)
|
||||||
|
{
|
||||||
|
case Themes.None:
|
||||||
|
var t = Registry.GetValue(
|
||||||
|
@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
|
||||||
|
"AppsUseLightTheme", 1);
|
||||||
|
isDark = t != null && (int) t == 0;
|
||||||
|
break;
|
||||||
|
case Themes.Dark:
|
||||||
|
case Themes.Light:
|
||||||
|
isDark = theme == Themes.Dark;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDark)
|
||||||
{
|
{
|
||||||
if (!Resources.MergedDictionaries.Contains(_darkDict))
|
if (!Resources.MergedDictionaries.Contains(_darkDict))
|
||||||
Resources.MergedDictionaries.Add(_darkDict);
|
Resources.MergedDictionaries.Add(_darkDict);
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="Styles/MainWindowStyles.xaml" />
|
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<converters:WindowStateMaximizedToThicknessConverter x:Key="WindowStateMaximizedToThicknessConverter" />
|
<converters:WindowStateMaximizedToThicknessConverter x:Key="WindowStateMaximizedToThicknessConverter" />
|
||||||
<converters:WindowStateNormalToThicknessConverter x:Key="WindowStateNormalToThicknessConverter" />
|
<converters:WindowStateNormalToThicknessConverter x:Key="WindowStateNormalToThicknessConverter" />
|
||||||
|
Reference in New Issue
Block a user