2022-05-15 11:30:15 +00:00
|
|
|
|
using Avalonia.Media;
|
2022-12-29 14:24:05 +00:00
|
|
|
|
using Ryujinx.Ava.UI.Windows;
|
2022-05-15 11:30:15 +00:00
|
|
|
|
using Ryujinx.HLE.Ui;
|
|
|
|
|
using System;
|
|
|
|
|
|
2022-12-29 14:24:05 +00:00
|
|
|
|
namespace Ryujinx.Ava.UI.Applet
|
2022-05-15 11:30:15 +00:00
|
|
|
|
{
|
|
|
|
|
class AvaloniaHostUiTheme : IHostUiTheme
|
|
|
|
|
{
|
|
|
|
|
public AvaloniaHostUiTheme(MainWindow parent)
|
|
|
|
|
{
|
2023-07-07 21:03:27 +00:00
|
|
|
|
FontFamily = OperatingSystem.IsWindows() && OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000) ? "Segoe UI Variable" : parent.FontFamily.Name;
|
2022-05-15 11:30:15 +00:00
|
|
|
|
DefaultBackgroundColor = BrushToThemeColor(parent.Background);
|
|
|
|
|
DefaultForegroundColor = BrushToThemeColor(parent.Foreground);
|
|
|
|
|
DefaultBorderColor = BrushToThemeColor(parent.BorderBrush);
|
2023-01-08 17:46:25 +00:00
|
|
|
|
SelectionBackgroundColor = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionBrush);
|
|
|
|
|
SelectionForegroundColor = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionForegroundBrush);
|
2022-05-15 11:30:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string FontFamily { get; }
|
|
|
|
|
|
|
|
|
|
public ThemeColor DefaultBackgroundColor { get; }
|
|
|
|
|
public ThemeColor DefaultForegroundColor { get; }
|
|
|
|
|
public ThemeColor DefaultBorderColor { get; }
|
|
|
|
|
public ThemeColor SelectionBackgroundColor { get; }
|
|
|
|
|
public ThemeColor SelectionForegroundColor { get; }
|
|
|
|
|
|
2023-07-07 21:03:27 +00:00
|
|
|
|
private static ThemeColor BrushToThemeColor(IBrush brush)
|
2022-05-15 11:30:15 +00:00
|
|
|
|
{
|
|
|
|
|
if (brush is SolidColorBrush solidColor)
|
|
|
|
|
{
|
|
|
|
|
return new ThemeColor((float)solidColor.Color.A / 255,
|
|
|
|
|
(float)solidColor.Color.R / 255,
|
|
|
|
|
(float)solidColor.Color.G / 255,
|
|
|
|
|
(float)solidColor.Color.B / 255);
|
|
|
|
|
}
|
2023-07-07 21:03:27 +00:00
|
|
|
|
|
|
|
|
|
return new ThemeColor();
|
2022-05-15 11:30:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|