Browse Source

Improve theming support for light and glass modes, adjust transparent backgrounds, and update text color resources

Ruben 4 months ago
parent
commit
73132ca1f2

+ 10 - 10
src/PicView.Avalonia.MacOS/Views/ExifWindow.axaml

@@ -39,7 +39,7 @@
                                                    FallbackValue=''}"
                 Data="{StaticResource RecycleGeometry}"
                 DockPanel.Dock="Right"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Height="28"
                 IconHeight="17"
                 IconWidth="17"
@@ -56,7 +56,7 @@
                 CommandParameter="{CompiledBinding PicViewer.FileInfo.FullName,
                                                    FallbackValue=''}"
                 DockPanel.Dock="Right"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Height="28"
                 Icon="{StaticResource PortalImage}"
                 IconHeight="17"
@@ -75,7 +75,7 @@
                                                    FallbackValue=''}"
                 Data="{StaticResource OpenWithGeometry}"
                 DockPanel.Dock="Right"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Height="28"
                 IconHeight="17"
                 IconWidth="17"
@@ -93,7 +93,7 @@
                                                    FallbackValue=''}"
                 Data="{StaticResource PrintGeometry}"
                 DockPanel.Dock="Right"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Height="28"
                 IconHeight="17"
                 IconWidth="17"
@@ -110,7 +110,7 @@
                 CommandParameter="{CompiledBinding PicViewer.FileInfo.FullName,
                                                    FallbackValue=''}"
                 DockPanel.Dock="Right"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Icon="{StaticResource CopyImages}"
                 IconHeight="17"
                 IconWidth="17"
@@ -128,7 +128,7 @@
                                                    FallbackValue=''}"
                 Data="{StaticResource CopyGeometry}"
                 DockPanel.Dock="Right"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Height="28"
                 IconHeight="17"
                 IconWidth="17"
@@ -146,7 +146,7 @@
                                                    FallbackValue=''}"
                 Data="{StaticResource DuplicateGeometry}"
                 DockPanel.Dock="Right"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Height="28"
                 IconHeight="17"
                 IconWidth="17"
@@ -164,7 +164,7 @@
                                                    FallbackValue=''}"
                 Data="{StaticResource ShowInFolderGeometry}"
                 DockPanel.Dock="Right"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Height="28"
                 IconHeight="17"
                 IconWidth="17"
@@ -183,7 +183,7 @@
                 CommandParameter="{CompiledBinding PicViewer.FileInfo.FullName,
                                                    FallbackValue=''}"
                 DockPanel.Dock="Right"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Icon="{StaticResource StarOffImage}"
                 IconHeight="17"
                 IconWidth="17"
@@ -195,7 +195,7 @@
             <TextBlock
                 Classes="txt"
                 DockPanel.Dock="Left"
-                Foreground="{DynamicResource MainTextColor}"
+                Foreground="{StaticResource SecondaryTextColor}"
                 Text="{CompiledBinding Translation.ImageInfo}"
                 TextAlignment="Center" />
 

+ 1 - 0
src/PicView.Avalonia.MacOS/Views/SettingsWindow.axaml.cs

@@ -25,6 +25,7 @@ public partial class SettingsWindow : Window
         {
             TitleText.Background = Brushes.Transparent;
             XSettingsView.Background = Brushes.Transparent;
+            SettingsButton.Background = Brushes.Transparent;
         }
         Loaded += delegate
         {

+ 5 - 0
src/PicView.Avalonia.MacOS/Views/SingleImageResizeWindow.axaml.cs

@@ -1,5 +1,6 @@
 using Avalonia.Controls;
 using Avalonia.Input;
+using Avalonia.Media;
 using PicView.Avalonia.UI;
 using PicView.Core.Localization;
 
@@ -11,6 +12,10 @@ public partial class SingleImageResizeWindow : Window
     {
         InitializeComponent();
         GenericWindowHelper.GenericWindowInitialize(this, TranslationManager.Translation.ResizeImage + " - PicView");
+        if (!Settings.Theme.Dark || Settings.Theme.GlassTheme)
+        {
+            XAboutView.Background = Brushes.Transparent;
+        }
     }
 
     private void MoveWindow(object? sender, PointerPressedEventArgs e)

+ 19 - 5
src/PicView.Avalonia/Views/AppearanceView.axaml

@@ -34,8 +34,22 @@
             Width="300"
             x:Name="ThemeBox">
             <ComboBoxItem Content="{CompiledBinding Translation.DarkTheme, Mode=OneWay}" x:Name="DarkThemeBox" />
-            <ComboBoxItem Content="{CompiledBinding Translation.LightTheme, Mode=OneWay}" x:Name="LightThemeBox" />
-            <ComboBoxItem Content="{CompiledBinding Translation.GlassTheme, Mode=OneWay}" x:Name="GlassThemeBox" />
+            <ComboBoxItem x:Name="LightThemeBox">
+                <TextBlock Classes="txt">
+                    <TextBlock.Inlines>
+                        <Run Text="{CompiledBinding Translation.LightTheme, Mode=OneWay}" />
+                        <Run FontStyle="Italic" Text=" (beta)" />
+                    </TextBlock.Inlines>
+                </TextBlock>
+            </ComboBoxItem>
+            <ComboBoxItem x:Name="GlassThemeBox">
+                <TextBlock Classes="txt">
+                    <TextBlock.Inlines>
+                        <Run Text="{CompiledBinding Translation.GlassTheme, Mode=OneWay}" />
+                        <Run FontStyle="Italic" Text=" (beta)" />
+                    </TextBlock.Inlines>
+                </TextBlock>
+            </ComboBoxItem>
         </ComboBox>
 
         <Button
@@ -264,8 +278,8 @@
                 x:Name="BlackBgButton" />
 
         </WrapPanel>
-        
-        
+
+
         <ToggleButton
             Background="Transparent"
             BorderThickness="0"
@@ -281,7 +295,7 @@
                 MaxWidth="240"
                 Padding="0,1,5,0"
                 Text="{CompiledBinding Translation.ConstrainBackgroundToImage,
-                                           Mode=OneWay}" />
+                                       Mode=OneWay}" />
         </ToggleButton>
 
         <TextBlock

+ 1 - 0
src/PicView.Avalonia/Views/AppearanceView.axaml.cs

@@ -6,6 +6,7 @@ using PicView.Avalonia.ColorManagement;
 using PicView.Avalonia.Gallery;
 using PicView.Avalonia.ViewModels;
 using PicView.Core.ColorHandling;
+using PicView.Core.Localization;
 using ReactiveUI;
 
 namespace PicView.Avalonia.Views;

+ 1 - 1
src/PicView.Avalonia/Views/SingleImageResizeView.axaml

@@ -11,7 +11,7 @@
     xmlns:uc="clr-namespace:PicView.Avalonia.Views.UC"
     xmlns:viewModels="clr-namespace:PicView.Avalonia.ViewModels;assembly=PicView.Avalonia"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-    <Panel Background="{DynamicResource TertiaryBackgroundColor}">
+    <Panel Background="{DynamicResource TertiaryBackgroundColor}" x:Name="BgPanel">
         <uc:SpinWaiter IsVisible="False" x:Name="SpinWaiter" />
 
         <StackPanel x:Name="ParentContainer">

+ 6 - 0
src/PicView.Avalonia/Views/SingleImageResizeView.axaml.cs

@@ -3,6 +3,7 @@ using Avalonia;
 using Avalonia.Controls;
 using Avalonia.Controls.ApplicationLifetimes;
 using Avalonia.Input;
+using Avalonia.Media;
 using Avalonia.Threading;
 using PicView.Avalonia.FileSystem;
 using PicView.Avalonia.Navigation;
@@ -34,6 +35,11 @@ public partial class SingleImageResizeView : UserControl
         {
             return;
         }
+        
+        if (!Settings.Theme.Dark || Settings.Theme.GlassTheme)
+        {
+            BgPanel.Background = Brushes.Transparent;
+        }
 
         _aspectRatio = (double)vm.PicViewer.PixelWidth / vm.PicViewer.PixelHeight;
 

+ 1 - 1
src/PicView.Avalonia/Views/UC/Buttons/SettingsMenuButton.axaml

@@ -17,7 +17,7 @@
         BorderThickness="1,0,0,0"
         Classes="hover"
         ClickMode="Press"
-        Foreground="{DynamicResource MainTextColor}"
+        Foreground="{StaticResource SecondaryTextColor}"
         Icon="{StaticResource MenuImage}"
         IconHeight="12"
         IconWidth="12"

+ 11 - 1
src/PicView.Avalonia/Views/UC/Buttons/SettingsMenuButton.axaml.cs

@@ -1,4 +1,6 @@
-using Avalonia.Controls;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Media;
 using PicView.Core.Keybindings;
 
 namespace PicView.Avalonia.Views.UC.Buttons;
@@ -10,5 +12,13 @@ public partial class SettingsMenuButton : UserControl
         InitializeComponent();
         ToolTip.SetTip(UserSettingsItem, CurrentSettingsPath);
         ToolTip.SetTip(KeybindingsItem, KeybindingFunctions.CurrentKeybindingsPath);
+        Loaded += (_, _) =>
+        {
+            if (!Settings.Theme.Dark || Settings.Theme.GlassTheme)
+            {
+                SettingsButton.Background = Brushes.Transparent;
+                SettingsButton.BorderThickness = new Thickness(0);
+            }
+        };
     }
 }