diff --git a/src/UniGetUI.Avalonia/Assets/Styles/Styles.Windows.axaml b/src/UniGetUI.Avalonia/Assets/Styles/Styles.Windows.axaml
index 8d2909c11e..6154a9ddbb 100644
--- a/src/UniGetUI.Avalonia/Assets/Styles/Styles.Windows.axaml
+++ b/src/UniGetUI.Avalonia/Assets/Styles/Styles.Windows.axaml
@@ -39,6 +39,8 @@
+
+
@@ -76,6 +78,8 @@
+
+
diff --git a/src/UniGetUI.Avalonia/ViewModels/DialogPages/OperationOutputViewModel.cs b/src/UniGetUI.Avalonia/ViewModels/DialogPages/OperationOutputViewModel.cs
index 84b78798a0..01807772c9 100644
--- a/src/UniGetUI.Avalonia/ViewModels/DialogPages/OperationOutputViewModel.cs
+++ b/src/UniGetUI.Avalonia/ViewModels/DialogPages/OperationOutputViewModel.cs
@@ -1,5 +1,7 @@
using System.Collections.ObjectModel;
+using Avalonia;
using Avalonia.Media;
+using Avalonia.Styling;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using UniGetUI.Avalonia.ViewModels.Pages.LogPages;
@@ -12,12 +14,17 @@ public partial class OperationOutputViewModel : ObservableObject
[ObservableProperty] private string _title = "";
public ObservableCollection OutputLines { get; } = new();
- private static readonly IBrush _errorBrush = new SolidColorBrush(Color.Parse("#FF6B6B"));
- private static readonly IBrush _debugBrush = new SolidColorBrush(Color.Parse("#888888"));
- private static readonly IBrush _normalBrush = Brushes.White;
+ private readonly IBrush _errorBrush;
+ private readonly IBrush _debugBrush;
+ private readonly IBrush _normalBrush;
public OperationOutputViewModel(AbstractOperation operation)
{
+ var theme = Application.Current?.ActualThemeVariant ?? ThemeVariant.Default;
+ _errorBrush = LookupBrush("StatusErrorForeground", theme, new SolidColorBrush(Color.Parse("#c62828")));
+ _debugBrush = LookupBrush("LogOutputVerboseForeground", theme, new SolidColorBrush(Color.Parse("#767676")));
+ _normalBrush = LookupBrush("SystemControlForegroundBaseHighBrush", theme, Brushes.White);
+
Title = operation.Metadata.Title;
foreach (var (text, type) in operation.GetOutput())
@@ -27,6 +34,13 @@ public OperationOutputViewModel(AbstractOperation operation)
Dispatcher.UIThread.Post(() => OutputLines.Add(MakeLine(ev.Item1, ev.Item2)));
}
+ private static IBrush LookupBrush(string key, ThemeVariant theme, IBrush fallback)
+ {
+ if (Application.Current?.TryGetResource(key, theme, out var resource) == true && resource is IBrush brush)
+ return brush;
+ return fallback;
+ }
+
private LogLineItem MakeLine(string text, AbstractOperation.LineType type)
{
IBrush brush = type switch
diff --git a/src/UniGetUI.Avalonia/ViewModels/DialogPages/OperationViewModel.cs b/src/UniGetUI.Avalonia/ViewModels/DialogPages/OperationViewModel.cs
index e55e419a09..2a3e9052ae 100644
--- a/src/UniGetUI.Avalonia/ViewModels/DialogPages/OperationViewModel.cs
+++ b/src/UniGetUI.Avalonia/ViewModels/DialogPages/OperationViewModel.cs
@@ -289,7 +289,6 @@ private static MenuItem Item(string translationKey, string svgName, bool enabled
Path = $"avares://UniGetUI.Avalonia/Assets/Symbols/{svgName}",
Width = 16,
Height = 16,
- Foreground = Brushes.White,
},
};
diff --git a/src/UniGetUI.Avalonia/Views/Controls/InfoBar.axaml b/src/UniGetUI.Avalonia/Views/Controls/InfoBar.axaml
index 518d3dd273..01fca7b2c2 100644
--- a/src/UniGetUI.Avalonia/Views/Controls/InfoBar.axaml
+++ b/src/UniGetUI.Avalonia/Views/Controls/InfoBar.axaml
@@ -6,6 +6,25 @@
xmlns:controls="using:UniGetUI.Avalonia.Views.Controls"
x:DataType="vm:InfoBarViewModel">
+
+
+
+
+
+
+
Color.Parse("#F7A800"),
@@ -53,29 +60,7 @@ private void ApplySeverity(InfoBarSeverity severity)
};
SeverityStrip.Background = new SolidColorBrush(stripColor);
- // Update body background/border from theme resources
- string bgKey = severity switch
- {
- InfoBarSeverity.Warning => "WarningBannerBackground",
- InfoBarSeverity.Error => "StatusErrorBackground",
- InfoBarSeverity.Success => "StatusSuccessBackground",
- _ => "StatusInfoBackground",
- };
- string borderKey = severity switch
- {
- InfoBarSeverity.Warning => "WarningBannerBorderBrush",
- InfoBarSeverity.Error => "StatusErrorBorderBrush",
- InfoBarSeverity.Success => "StatusSuccessBorderBrush",
- _ => "StatusInfoBorderBrush",
- };
-
- var theme = Application.Current?.ActualThemeVariant;
- if (Application.Current?.TryGetResource(bgKey, theme, out var bg) == true && bg is IBrush bgBrush)
- BodyBorder.Background = bgBrush;
- if (Application.Current?.TryGetResource(borderKey, theme, out var border) == true && border is IBrush borderBrush)
- BodyBorder.BorderBrush = borderBrush;
-
- // Update icon
+ // Icon shape
SeverityIcon.Data = Geometry.Parse(severity switch
{
InfoBarSeverity.Warning => WarningPath,
@@ -84,14 +69,7 @@ private void ApplySeverity(InfoBarSeverity severity)
_ => InfoPath,
});
- // Icon foreground
- var iconColor = severity switch
- {
- InfoBarSeverity.Warning => Color.Parse("#F7A800"),
- InfoBarSeverity.Error => Color.Parse("#C42B1C"),
- InfoBarSeverity.Success => Color.Parse("#107C10"),
- _ => Color.Parse("#0078D4"),
- };
- SeverityIcon.Foreground = new SolidColorBrush(iconColor);
+ // Icon foreground (solid, not theme-sensitive)
+ SeverityIcon.Foreground = new SolidColorBrush(stripColor);
}
}
diff --git a/src/UniGetUI.Avalonia/Views/Controls/SvgIcon.cs b/src/UniGetUI.Avalonia/Views/Controls/SvgIcon.cs
index 0440dc9786..ca5d61d3ba 100644
--- a/src/UniGetUI.Avalonia/Views/Controls/SvgIcon.cs
+++ b/src/UniGetUI.Avalonia/Views/Controls/SvgIcon.cs
@@ -5,8 +5,10 @@
using Avalonia;
using Avalonia.Automation;
using Avalonia.Controls;
+using Avalonia.Data;
using Avalonia.Media;
using Avalonia.Platform;
+using Avalonia.Styling;
namespace UniGetUI.Avalonia.Views.Controls;
@@ -35,6 +37,7 @@ public string? Path
set => SetValue(PathProperty, value);
}
+ private IBrush? _localForeground;
public IBrush? Foreground
{
get => GetValue(ForegroundProperty);
@@ -50,13 +53,35 @@ static SvgIcon()
AffectsMeasure(PathProperty);
}
+ protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ base.OnAttachedToVisualTree(e);
+ if (Application.Current is { } app)
+ app.ActualThemeVariantChanged += OnThemeChanged;
+ }
+
+ protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ base.OnDetachedFromVisualTree(e);
+ if (Application.Current is { } app)
+ app.ActualThemeVariantChanged -= OnThemeChanged;
+ }
+
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
- if (change.Property == PathProperty)
+ if (change.Property == ForegroundProperty)
+ {
+ _localForeground = change.Priority < BindingPriority.Style
+ ? change.NewValue as IBrush
+ : null;
+ }
+ else if (change.Property == PathProperty)
LoadSvg(change.NewValue as string);
}
+ private void OnThemeChanged(object? sender, EventArgs e) => InvalidateVisual();
+
private void LoadSvg(string? uri)
{
_geometries.Clear();
@@ -134,6 +159,14 @@ private void LoadSvg(string? uri)
InvalidateVisual();
}
+ private static readonly IBrush _darkFg = new SolidColorBrush(Color.Parse("#E8E8E8"));
+ private static readonly IBrush _lightFg = new SolidColorBrush(Color.Parse("#1E1E1E"));
+
+ private static IBrush LookupThemeForeground() =>
+ Application.Current?.ActualThemeVariant == ThemeVariant.Dark
+ ? _darkFg
+ : _lightFg;
+
protected override Size MeasureOverride(Size availableSize)
{
double w = double.IsInfinity(availableSize.Width) ? _viewBoxWidth : availableSize.Width;
@@ -145,7 +178,7 @@ public override void Render(DrawingContext context)
{
if (_geometries.Count == 0) return;
- IBrush brush = Foreground ?? Brushes.Black;
+ IBrush brush = _localForeground ?? LookupThemeForeground();
double scaleX = Bounds.Width / _viewBoxWidth;
double scaleY = Bounds.Height / _viewBoxHeight;
diff --git a/src/UniGetUI.Avalonia/Views/MainWindow.axaml b/src/UniGetUI.Avalonia/Views/MainWindow.axaml
index 52c2e22019..c9c8d0d9dc 100644
--- a/src/UniGetUI.Avalonia/Views/MainWindow.axaml
+++ b/src/UniGetUI.Avalonia/Views/MainWindow.axaml
@@ -211,7 +211,7 @@
+ Foreground="{DynamicResource AppIconForeground}"/>