12345678910111213141516171819202122232425 |
- using System;
- using System.Globalization;
- using Avalonia;
- using Avalonia.Data.Converters;
- using Avalonia.Media;
- using Avalonia.Styling;
- namespace SukiUI.Converters.WaveProgress;
- public class WaveProgressValueColorConverter : IValueConverter
- {
- public static readonly WaveProgressValueColorConverter Instance = new();
- public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- if (value is not double d) return Brushes.Black;
- if (d > 50) return Brushes.GhostWhite;
- return Application.Current?.ActualThemeVariant == ThemeVariant.Dark ? Brushes.GhostWhite : Brushes.Black;
- }
- public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- throw new NotSupportedException();
- }
- }
|