Ruben 6 mēneši atpakaļ
vecāks
revīzija
e21336b049

+ 17 - 0
src/PicView.Avalonia/UI/FileHistory/FileHistoryMenuBuilder.cs

@@ -49,6 +49,23 @@ public class FileHistoryMenuBuilder(Panel menuContainer, MainViewModel viewModel
             FontFamily = new FontFamily("avares://PicView.Avalonia/Assets/Fonts/Roboto-Bold.ttf#Roboto"),
             Classes = { "txt" }
         };
+        if (!Settings.Theme.Dark)
+        {
+            if (!Application.Current.TryGetResource("MainTextColor",
+                    Application.Current.RequestedThemeVariant, out var mainTextColor))
+            {
+                throw new InvalidOperationException();
+            }
+
+            if (mainTextColor is not Color color)
+            {
+                throw new InvalidOperationException();
+            }
+
+            var brush = new SolidColorBrush(color);
+            pinnedHeader.Foreground = brush;
+        }
+
         menuContainer.Children.Add(pinnedHeader);
 
         // Add pinned entries

+ 53 - 3
src/PicView.Avalonia/UI/FileHistory/FileHistoryMenuItem.cs

@@ -109,12 +109,15 @@ namespace PicView.Avalonia.UI.FileHistory
                 Padding = new Thickness(5, 6),
                 Width = 355
             };
+            
+            TextBlock? indexText = null;
+            TextBlock? headerText = null;
 
             if (index < 0)
             {
                 // Pinned item without index number
                 item.Padding = new Thickness(15, 0, 0, 0);
-                item.Content = new TextBlock
+                headerText = new TextBlock
                 {
                     Classes = { "txt" },
                     Text = header,
@@ -124,20 +127,67 @@ namespace PicView.Avalonia.UI.FileHistory
             else
             {
                 // Regular item with index number
-                var indexText = new TextBlock
+                indexText = new TextBlock
                 {
                     Classes = { "txt" },
                     Text = (index + 1).ToString(),
                     Padding = new Thickness(5, 0, 2, 0)
                 };
 
-                var headerText = new TextBlock
+                headerText = new TextBlock
                 {
                     Classes = { "txt" },
                     Text = header,
                     Padding = new Thickness(5, 0, 0, 0)
                 };
+            }
+            
+            if (!Settings.Theme.Dark)
+            {
+                if (!Application.Current.TryGetResource("MainTextColor",
+                        Application.Current.RequestedThemeVariant, out var mainTextColor) ||
+                    !Application.Current.TryGetResource("SecondaryTextColor", Application.Current.RequestedThemeVariant, out var secondaryTextColor))
+                {
+                    throw new InvalidOperationException();
+                }
 
+                if (mainTextColor is not Color color || secondaryTextColor is not Color secondaryColor)
+                {
+                    throw new InvalidOperationException();
+                }
+
+                var brush = new SolidColorBrush(color);
+                var secondaryBrush = new SolidColorBrush(secondaryColor);
+                if (indexText is not null)
+                {
+                    indexText.Foreground = brush;
+                }
+                headerText.Foreground = brush;
+
+                item.PointerEntered += delegate
+                {
+                    if (indexText is not null)
+                    {
+                        indexText.Foreground = secondaryBrush;
+                    }
+                    headerText.Foreground = secondaryBrush;
+                };
+                item.PointerExited += delegate
+                {
+                    if (indexText is not null)
+                    {
+                        indexText.Foreground = brush;
+                    }
+                    headerText.Foreground = brush;
+                };
+            }
+
+            if (index < 0)
+            {
+                item.Content = headerText;
+            }
+            else
+            {
                 item.Content = new StackPanel
                 {
                     Orientation = Orientation.Horizontal,

+ 11 - 4
src/PicView.Avalonia/Views/MainView.axaml

@@ -257,11 +257,14 @@
                                         Fill="{StaticResource Brush0}"
                                         Height="12"
                                         Stretch="Fill"
-                                        Width="12" />
+                                        Width="12"
+                                        x:Name="HistoryClearPath" />
                                     <TextBlock
                                         Classes="txt"
+                                        Foreground="{DynamicResource MainTextColor}"
                                         Margin="5,0,0,0"
-                                        Text="{CompiledBinding Translation.Clear}" />
+                                        Text="{CompiledBinding Translation.Clear}"
+                                        x:Name="HistoryClearTextBlock" />
                                 </StackPanel>
                             </Button>
 
@@ -277,11 +280,14 @@
                                         Fill="{StaticResource Brush0}"
                                         Height="12"
                                         Stretch="Fill"
-                                        Width="12" />
+                                        Width="12"
+                                        x:Name="HistoryFileButtonPath" />
                                     <TextBlock
                                         Classes="txt"
+                                        Foreground="{DynamicResource MainTextColor}"
                                         Margin="5,0,0,0"
-                                        Text="{CompiledBinding Translation.OpenFileHistory}" />
+                                        Text="{CompiledBinding Translation.OpenFileHistory}"
+                                        x:Name="HistoryFileNameTextBlock" />
                                 </StackPanel>
                             </Button>
 
@@ -290,6 +296,7 @@
                                 Classes="hover"
                                 CornerRadius="0,8,0,0"
                                 DockPanel.Dock="Right"
+                                Foreground="{DynamicResource MainTextColor}"
                                 Icon="{StaticResource SortDescImage}"
                                 IconHeight="12"
                                 IconWidth="12"

+ 38 - 0
src/PicView.Avalonia/Views/MainView.axaml.cs

@@ -25,6 +25,44 @@ public partial class MainView : UserControl
     {
         InitializeComponent();
 
+        if (!Settings.Theme.Dark && !Settings.Theme.GlassTheme)
+        {
+            if (!Application.Current.TryGetResource("MainTextColor",
+                    Application.Current.RequestedThemeVariant, out var mainTextColor) ||
+                !Application.Current.TryGetResource("SecondaryTextColor", Application.Current.RequestedThemeVariant, out var secondaryTextColor))
+            {
+                return;
+            }
+
+            if (mainTextColor is not Color color || secondaryTextColor is not Color secondaryColor)
+            {
+                return;
+            }
+
+            var brush = new SolidColorBrush(color);
+            var secondaryBrush = new SolidColorBrush(secondaryColor);
+            HistoryClearButton.PointerEntered += delegate       
+            {
+                HistoryClearTextBlock.Foreground = secondaryBrush;
+                HistoryClearPath.Fill = secondaryBrush;
+            };
+            HistoryClearButton.PointerExited += delegate       
+            {
+                HistoryClearTextBlock.Foreground = brush;
+                HistoryClearPath.Fill = brush;
+            };
+            HistoryFileButton.PointerEntered += delegate       
+            {
+                HistoryFileNameTextBlock.Foreground = secondaryBrush;
+                HistoryFileButtonPath.Fill = secondaryBrush;
+            };
+            HistoryFileButton.PointerExited += delegate       
+            {
+                HistoryFileNameTextBlock.Foreground = brush;
+                HistoryFileButtonPath.Fill = brush;
+            };
+        }
+
         Loaded += delegate
         {
             AddHandler(DragDrop.DragEnterEvent, DragEnter);

+ 14 - 11
src/PicView.Avalonia/Views/UC/Buttons/PinButton.axaml

@@ -6,27 +6,30 @@
     x:Class="PicView.Avalonia.Views.UC.Buttons.PinButton"
     x:DataType="viewModels:MainViewModel"
     xmlns="https://github.com/avaloniaui"
-    xmlns:customControls="clr-namespace:PicView.Avalonia.CustomControls"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:viewModels="clr-namespace:PicView.Avalonia.ViewModels"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
     <Panel>
-        <customControls:IconButton
+        <Button
             Background="Transparent"
-            Icon="{StaticResource PinImage}"
-            IconHeight="12"
-            IconWidth="12"
             ToolTip.Tip="{CompiledBinding Translation.Pin,
                                           Mode=OneWay}"
-            x:Name="PinBtn" />
-        <customControls:IconButton
+            x:Name="PinBtn">
+            <Image
+                Height="12"
+                Source="{StaticResource PinImage}"
+                Width="12" />
+        </Button>
+        <Button
             Background="Transparent"
-            Icon="{StaticResource UnPinImage}"
-            IconHeight="12"
-            IconWidth="12"
             ToolTip.Tip="{CompiledBinding Translation.Unpin,
                                           Mode=OneWay}"
-            x:Name="UnPinBtn" />
+            x:Name="UnPinBtn">
+            <Image
+                Height="12"
+                Source="{StaticResource UnPinImage}"
+                Width="12" />
+        </Button>
     </Panel>
 </UserControl>