Skip to content

Commit

Permalink
Theme updates, glass theme, light theme switching, misc theme fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Oct 6, 2024
1 parent 7652000 commit b1a8b5b
Show file tree
Hide file tree
Showing 44 changed files with 680 additions and 397 deletions.
13 changes: 12 additions & 1 deletion src/PicView.Avalonia.Win32/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,18 @@ public override async void OnFrameworkInitializationCompleted()

await Dispatcher.UIThread.InvokeAsync(() =>
{
Current.RequestedThemeVariant = SettingsHelper.Settings.Theme.Dark ? ThemeVariant.Dark : ThemeVariant.Light;
if (SettingsHelper.Settings.Theme.GlassTheme)
{
Current.RequestedThemeVariant = ThemeVariant.Light;
}
else if (SettingsHelper.Settings.Theme.UseSystemTheme)
{
Current.RequestedThemeVariant = ThemeVariant.Dark; // TODO : Figure out how to get the system theme
}
else
{
Current.RequestedThemeVariant = SettingsHelper.Settings.Theme.Dark ? ThemeVariant.Dark : ThemeVariant.Light;
}
_mainWindow = new WinMainWindow();
desktop.MainWindow = _mainWindow;
});
Expand Down
17 changes: 9 additions & 8 deletions src/PicView.Avalonia.Win32/Views/AboutWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
BorderBrush="{DynamicResource WindowBorderColor}"
BorderThickness="1"
CornerRadius="8"
PointerPressed="MoveWindow">
PointerPressed="MoveWindow"
x:Name="ParentBorder">
<StackPanel>

<DockPanel Height="28" LastChildFill="True">
Expand All @@ -41,42 +42,42 @@
</Border>

<customControls:IconButton
Background="{DynamicResource MainButtonBackgroundColor}"
Background="{DynamicResource WindowButtonBackgroundColor}"
BorderThickness="0"
Classes="hover"
Click="Close"
CornerRadius="0,8,0,0"
Data="{StaticResource CloseGeometry}"
DockPanel.Dock="Right"
Foreground="{StaticResource SecondaryTextColor}"
Foreground="{DynamicResource MainTextColor}"
IconHeight="10"
IconWidth="10"
Width="30"
x:Name="CloseButton" />

<customControls:IconButton
Background="{DynamicResource MainButtonBackgroundColor}"
Background="{DynamicResource WindowButtonBackgroundColor}"
BorderBrush="{DynamicResource MainBorderColor}"
BorderThickness="1,0,1,0"
Classes="hover"
Click="Minimize"
Data="{StaticResource MinimizeGeometry}"
DockPanel.Dock="Right"
Foreground="{StaticResource SecondaryTextColor}"
Foreground="{DynamicResource MainTextColor}"
IconHeight="12"
IconWidth="12"
Width="30"
x:Name="MinimizeButton" />

<TextBlock
Background="{DynamicResource SecondaryBackgroundColor}"
Background="{DynamicResource WindowSecondaryBackgroundColor}"
Classes="txt"
Foreground="{StaticResource SecondaryTextColor}"
Foreground="{DynamicResource MainTextColor}"
Height="28"
LineHeight="28"
Text="{CompiledBinding About}"
TextAlignment="Center"
x:Name="AboutText" />
x:Name="TitleText" />
</DockPanel>

<Rectangle
Expand Down
23 changes: 21 additions & 2 deletions src/PicView.Avalonia.Win32/Views/AboutWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class AboutWindow : Window
public AboutWindow()
{
InitializeComponent();
if (!SettingsHelper.Settings.Theme.Dark)
if (SettingsHelper.Settings.Theme.GlassTheme)
{
IconBorder.Background = Brushes.Transparent;
IconBorder.BorderThickness = new Thickness(0);
Expand All @@ -22,7 +22,26 @@ public AboutWindow()
CloseButton.Background = Brushes.Transparent;
CloseButton.BorderThickness = new Thickness(0);
BorderRectangle.Height = 0;
AboutText.Background = Brushes.Transparent;
TitleText.Background = Brushes.Transparent;

if (!Application.Current.TryGetResource("SecondaryTextColor",
Application.Current.RequestedThemeVariant, out var textColor))
{
return;
}

if (textColor is not Color color)
{
return;
}

TitleText.Foreground = new SolidColorBrush(color);
MinimizeButton.Foreground = new SolidColorBrush(color);
CloseButton.Foreground = new SolidColorBrush(color);
}
else if (!SettingsHelper.Settings.Theme.Dark)
{
ParentBorder.Background = new SolidColorBrush(Color.FromArgb(114,132, 132, 132));
}
Loaded += delegate
{
Expand Down
32 changes: 22 additions & 10 deletions src/PicView.Avalonia.Win32/Views/ExifWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
<Border
BorderBrush="{DynamicResource WindowBorderColor}"
BorderThickness="1"
CornerRadius="0,0,8,8">
<DockPanel Background="Transparent" PointerPressed="MoveWindow">
CornerRadius="0,0,8,8"
PointerPressed="MoveWindow"
x:Name="ParentBorder">
<DockPanel Background="Transparent">
<StackPanel
Background="{DynamicResource WindowBackgroundColor}"
DockPanel.Dock="Top"
Expand All @@ -49,9 +51,11 @@
Width="131">
<TextBlock
Classes="txt"
Foreground="{DynamicResource MainTextColor}"
HorizontalAlignment="Center"
Text="{CompiledBinding DuplicateFile}"
VerticalAlignment="Center" />
VerticalAlignment="Center"
x:Name="DuplicateText" />
</Button>

<Button
Expand All @@ -63,9 +67,11 @@
Width="130">
<TextBlock
Classes="txt"
Foreground="{DynamicResource MainTextColor}"
HorizontalAlignment="Center"
Text="{Binding DeleteFile}"
VerticalAlignment="Center" />
VerticalAlignment="Center"
x:Name="RecycleText" />
</Button>

<Button
Expand All @@ -77,9 +83,11 @@
Width="130">
<TextBlock
Classes="txt"
Foreground="{DynamicResource MainTextColor}"
HorizontalAlignment="Center"
Text="{Binding OptimizeImage}"
VerticalAlignment="Center" />
VerticalAlignment="Center"
x:Name="OptimizeText" />
</Button>

<Button
Expand All @@ -93,9 +101,11 @@
Width="130">
<TextBlock
Classes="txt"
Foreground="{DynamicResource MainTextColor}"
HorizontalAlignment="Center"
Text="{Binding OpenWith}"
VerticalAlignment="Center" />
VerticalAlignment="Center"
x:Name="OpenWithText" />
</Button>

<Button
Expand All @@ -109,12 +119,14 @@
Width="131">
<TextBlock
Classes="txt"
Foreground="{DynamicResource MainTextColor}"
HorizontalAlignment="Center"
Text="{Binding ShowInFolder}"
VerticalAlignment="Center" />
VerticalAlignment="Center"
x:Name="LocateOnDiskText" />
</Button>
<buttons:StarOutlineButtons
Background="{DynamicResource FadedBackgroundColor}"
Background="{DynamicResource SecondaryBackgroundColor}"
Padding="5,0,0,3"
x:Name="StarOutlineButtons" />

Expand All @@ -126,7 +138,7 @@
Click="Minimize"
Data="{StaticResource MinimizeGeometry}"
DockPanel.Dock="Right"
Foreground="{StaticResource SecondaryTextColor}"
Foreground="{DynamicResource MainTextColor}"
IconHeight="12"
IconWidth="12"
Width="29"
Expand All @@ -140,7 +152,7 @@
Click="Close"
Data="{StaticResource CloseGeometry}"
DockPanel.Dock="Right"
Foreground="{StaticResource SecondaryTextColor}"
Foreground="{DynamicResource MainTextColor}"
IconHeight="10"
IconWidth="10"
Width="29"
Expand Down
25 changes: 24 additions & 1 deletion src/PicView.Avalonia.Win32/Views/ExifWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,37 @@ public partial class ExifWindow : Window
public ExifWindow()
{
InitializeComponent();
if (!SettingsHelper.Settings.Theme.Dark)
if (SettingsHelper.Settings.Theme.GlassTheme)
{
TopWindowBorder.Background = Brushes.Transparent;

CloseButton.Background = Brushes.Transparent;
CloseButton.BorderThickness = new Thickness(0);
MinimizeButton.Background = Brushes.Transparent;
MinimizeButton.BorderThickness = new Thickness(0);

if (!Application.Current.TryGetResource("SecondaryTextColor",
Application.Current.RequestedThemeVariant, out var textColor))
{
return;
}

if (textColor is not Color color)
{
return;
}

MinimizeButton.Foreground = new SolidColorBrush(color);
CloseButton.Foreground = new SolidColorBrush(color);
RecycleText.Foreground = new SolidColorBrush(color);
DuplicateText.Foreground = new SolidColorBrush(color);
OptimizeText.Foreground = new SolidColorBrush(color);
OpenWithText.Foreground = new SolidColorBrush(color);
LocateOnDiskText.Foreground = new SolidColorBrush(color);
}
else if (!SettingsHelper.Settings.Theme.Dark)
{
ParentBorder.Background = new SolidColorBrush(Color.FromArgb(114,132, 132, 132));
}
Title = TranslationHelper.GetTranslation("ImageInfo") + " - PicView";
KeyDown += (_, e) =>
Expand Down
16 changes: 11 additions & 5 deletions src/PicView.Avalonia.Win32/Views/KeybindingsWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
<Border
BorderBrush="{DynamicResource WindowBorderColor}"
BorderThickness="1"
CornerRadius="0,0,8,8"
PointerPressed="MoveWindow">
CornerRadius="8"
PointerPressed="MoveWindow"
x:Name="ParentBorder">
<Panel>

<DockPanel
Expand All @@ -32,6 +33,7 @@
Background="{DynamicResource WindowBackgroundColor}"
BorderBrush="{DynamicResource MainBorderColor}"
BorderThickness="0,0,1,1"
CornerRadius="8,8,0,0"
DockPanel.Dock="Left"
x:Name="TopWindowBorder">
<Image
Expand All @@ -47,9 +49,10 @@
BorderThickness="0,0,1,1"
Classes="hover"
Click="Close"
CornerRadius="0,8,0,0"
Data="{StaticResource CloseGeometry}"
DockPanel.Dock="Right"
Foreground="{StaticResource SecondaryTextColor}"
Foreground="{DynamicResource MainTextColor}"
IconHeight="10"
IconWidth="10"
ToolTip.Tip="{CompiledBinding Close,
Expand All @@ -64,15 +67,16 @@
Classes="hover"
Data="{StaticResource MinimizeGeometry}"
DockPanel.Dock="Right"
Foreground="{DynamicResource MainTextColor}"
IconHeight="12"
IconWidth="12"
Width="30"
x:Name="MinimizeButton" />

<TextBlock
Background="{StaticResource SecondaryBackgroundColor}"
Background="{DynamicResource WindowSecondaryBackgroundColor}"
Classes="txt"
Foreground="{StaticResource SecondaryTextColor}"
Foreground="{DynamicResource MainTextColor}"
LineHeight="28"
Text="{CompiledBinding ApplicationShortcuts}"
TextAlignment="Center"
Expand All @@ -82,6 +86,8 @@
<Rectangle
Fill="{DynamicResource WindowBorderColor}"
Height="1"
Margin="0,28,0,0"
VerticalAlignment="Top"
x:Name="BorderRectangle" />

<customControls:AutoScrollViewer
Expand Down
23 changes: 20 additions & 3 deletions src/PicView.Avalonia.Win32/Views/KeybindingsWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class KeybindingsWindow : Window
public KeybindingsWindow()
{
InitializeComponent();
if (!SettingsHelper.Settings.Theme.Dark)
if (SettingsHelper.Settings.Theme.GlassTheme)
{
TopWindowBorder.Background = Brushes.Transparent;
TopWindowBorder.BorderThickness = new Thickness(0);
Expand All @@ -22,10 +22,27 @@ public KeybindingsWindow()
CloseButton.BorderThickness = new Thickness(0);
MinimizeButton.Background = Brushes.Transparent;
MinimizeButton.BorderThickness = new Thickness(0);

BorderRectangle.Height = 0;
TitleText.Background = Brushes.Transparent;

BorderRectangle.Height = 0;
if (!Application.Current.TryGetResource("SecondaryTextColor",
Application.Current.RequestedThemeVariant, out var textColor))
{
return;
}

if (textColor is not Color color)
{
return;
}

TitleText.Foreground = new SolidColorBrush(color);
MinimizeButton.Foreground = new SolidColorBrush(color);
CloseButton.Foreground = new SolidColorBrush(color);
}
else if (!SettingsHelper.Settings.Theme.Dark)
{
ParentBorder.Background = new SolidColorBrush(Color.FromArgb(114,132, 132, 132));
}
Loaded += delegate
{
Expand Down
Loading

0 comments on commit b1a8b5b

Please sign in to comment.