ソースを参照

Improve theme consistency and hover styling for Glass Theme.

- Added consistent hover states and styling to buttons across `BottomBar`, `FileMenu`, and other views.
- Optimized geometry definitions in XAML files for cleaner code and better performance.
- Updated `GlassThemeHelper` with new transparent background colors for reusable use cases.
- Refined separator styling in `WinTitleBar.axaml` for better alignment and opacity control.
Ruben 1 日 前
コミット
93d8638392

+ 5 - 2
src/PicView.Avalonia.Win32/Views/ImageInfoWindow.axaml.cs

@@ -29,6 +29,7 @@ public partial class ImageInfoWindow : Window, IDisposable
             TopWindowBorder.Background = Brushes.Transparent;
             StarOutlineButtons.Background = Brushes.Transparent;
             RemoveRatingButton.Background = Brushes.Transparent;
+            ExifView.Background = Brushes.Transparent;
             
             CloseButton.Background = Brushes.Transparent;
             CloseButton.BorderThickness = new Thickness(0);
@@ -83,8 +84,10 @@ public partial class ImageInfoWindow : Window, IDisposable
         }
         if (!Settings.Theme.Dark)
         {
-
-            ExifView.Background = UIHelper.GetMenuBackgroundColor();
+            if (!Settings.Theme.GlassTheme)
+            {
+                ExifView.Background = UIHelper.GetMenuBackgroundColor();
+            }
             var copyButtons =  ExifView.GetVisualChildren().OfType<CopyButton>();
             foreach (var btn in copyButtons)
             {

+ 64 - 16
src/PicView.Avalonia.Win32/Views/WinTitleBar.axaml

@@ -286,7 +286,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource MainBorderColor}"
+                        Margin="0"
+                        Opacity=".3" />
 
                     <!--  Close  -->
                     <MenuItem
@@ -364,7 +367,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Duplicate file  -->
                     <MenuItem
@@ -392,7 +398,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Delete file  -->
                     <MenuItem
@@ -497,7 +506,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Fullscreen  -->
                     <MenuItem
@@ -601,7 +613,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Optimize image  -->
                     <MenuItem
@@ -619,7 +634,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Crop  -->
                     <MenuItem
@@ -635,7 +653,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Flip  -->
                     <MenuItem
@@ -721,7 +742,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
 
                     <!--  Next 10  -->
@@ -792,7 +816,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  First Image  -->
                     <MenuItem
@@ -826,7 +853,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Next folder  -->
                     <MenuItem
@@ -939,7 +969,10 @@
                         Theme="{StaticResource MainBg}"
                         ToggleType="Radio" />
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Sort files ascending  -->
                     <MenuItem
@@ -975,7 +1008,10 @@
                         Theme="{StaticResource MainBg}"
                         ToggleType="CheckBox" />
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Toggle looping  -->
                     <MenuItem
@@ -986,7 +1022,10 @@
                         Theme="{StaticResource MainBg}"
                         ToggleType="CheckBox" />
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Toggle scrolling  -->
                     <MenuItem
@@ -1005,7 +1044,10 @@
                         Theme="{StaticResource MainBg}"
                         ToggleType="CheckBox" />
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Toggle topmost  -->
                     <MenuItem
@@ -1025,7 +1067,10 @@
                         Theme="{StaticResource MainBg}"
                         ToggleType="CheckBox" />
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Toggle ctrl zoom  -->
                     <MenuItem
@@ -1041,7 +1086,10 @@
                         </MenuItem.Icon>
                     </MenuItem>
 
-                    <Separator Margin="0" Opacity="1" />
+                    <Separator
+                        Background="{DynamicResource ContextMenuBackgroundColor}"
+                        Margin="0"
+                        Opacity=".9" />
 
                     <!--  Show Settings window  -->
                     <MenuItem

+ 4 - 0
src/PicView.Avalonia/ColorManagement/GlassThemeHelper.cs

@@ -46,6 +46,10 @@ public static class GlassThemeHelper
         Application.Current.Resources["MenuButtonColor"] = Color.Parse("#50797979");
         
         Application.Current.Resources["WindowBorderColor"] = Color.Parse("#15FFFFFF");
+
+        Application.Current.Resources["DropDownBgColor"] = Color.Parse("#CC464646");
+
+        Application.Current.Resources["WindowButtonBackgroundColor"] = Color.Parse("#CC464646");
     }
 
     public static void ApplyTransparentStyle(Menu borderLike)

+ 1 - 1
src/PicView.Avalonia/PicViewTheme/Controls/MenuItem.axaml

@@ -211,7 +211,7 @@
     </ControlTheme>
 
     <ControlTheme TargetType="MenuItem" x:Key="MainBg">
-        <Setter Property="Background" Value="{DynamicResource MainBackgroundColor}" />
+        <Setter Property="Background" Value="{DynamicResource SecondaryBackgroundColor}" />
         <Setter Property="Foreground" Value="{DynamicResource MainTextColor}" />
         <Setter Property="BorderThickness" Value="1" />
         <Setter Property="CornerRadius" Value="0" />

+ 1 - 2
src/PicView.Avalonia/Views/Main/ImageInfoView.axaml.cs

@@ -85,8 +85,7 @@ public partial class ImageInfoView : UserControl
             SizeChanged += (_, _) => ResponsiveResizeUpdate(vm);
 
             RemoveImageDataMenuItem.Click += async (_, _) => { await RemoveImageDataAsync(); };
-
-            ;
+            
             FileNameTextBox.KeyDown += async (_, e) =>
                 await HandleRenameOnEnterAsync(e, () =>
                     Path.Combine(vm.PicViewer.FileInfo.CurrentValue.DirectoryName!, FileNameTextBox.Text));

+ 20 - 2
src/PicView.Avalonia/Views/UC/BottomBar.axaml.cs

@@ -52,6 +52,8 @@ public partial class BottomBar : UserControl
 
             if (Settings.Theme.GlassTheme)
             {
+                var alphaBrush = new SolidColorBrush(Color.FromArgb(15, 100, 100, 100));
+                
                 MainBottomBorder.Background = Brushes.Transparent;
                 MainBottomBorder.BorderThickness = new Thickness(0);
 
@@ -71,9 +73,25 @@ public partial class BottomBar : UserControl
                 SettingsMenuButton.Classes.Remove("noBorderHover");
                 SettingsMenuButton.Classes.Add("hover");
 
-                NextButton.Background = new SolidColorBrush(Color.FromArgb(15, 255, 255, 255));
+                ZoomInButton.Background = alphaBrush;
+                ZoomInButton.Classes.Remove("noBorderHover");
+                ZoomInButton.Classes.Add("hover");
+
+                ZoomOutButton.Background = alphaBrush;
+                ZoomOutButton.Classes.Remove("noBorderHover");
+                ZoomOutButton.Classes.Add("hover");
+
+                NextButton.Background = alphaBrush;
 
-                PreviousButton.Background = new SolidColorBrush(Color.FromArgb(15, 255, 255, 255));
+                PreviousButton.Background = alphaBrush;
+
+                RotateRightButton.Background = alphaBrush;
+                RotateRightButton.Classes.Remove("noBorderHover");
+                RotateRightButton.Classes.Add("hover");
+
+                FlipButton.Background = alphaBrush;
+                FlipButton.Classes.Remove("noBorderHover");
+                FlipButton.Classes.Add("hover");
 
                 FileMenuButton.Foreground = new SolidColorBrush(color);
                 ImageMenuButton.Foreground = new SolidColorBrush(color);

+ 4 - 1
src/PicView.Avalonia/Views/UC/Menus/FileMenu.axaml

@@ -37,7 +37,10 @@
             BorderThickness="1"
             CornerRadius="8"
             Effect="{DynamicResource MenuShadowButtonBorder}">
-            <Canvas Height="208" Width="315">
+            <Canvas
+                Height="208"
+                Width="315"
+                x:Name="MainCanvas">
 
                 <Border
                     Background="{DynamicResource SecondaryBackgroundColor}"