Files
Wino-Mail/Wino.Core.WinUI/Services/UnderlyingThemeService.cs
T

29 lines
951 B
C#
Raw Normal View History

2024-04-18 01:44:37 +02:00
using Windows.UI.ViewManagement;
using Wino.Core.Domain.Enums;
2024-04-18 01:44:37 +02:00
using Wino.Core.Domain.Interfaces;
2025-09-29 11:23:44 +02:00
namespace Wino.Core.WinUI.Services;
2025-02-16 11:54:23 +01:00
public class UnderlyingThemeService : IUnderlyingThemeService
2024-04-18 01:44:37 +02:00
{
2025-02-16 11:54:23 +01:00
public const string SelectedAppThemeKey = nameof(SelectedAppThemeKey);
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
private readonly UISettings uiSettings = new UISettings();
private readonly IConfigurationService _configurationService;
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
public UnderlyingThemeService(IConfigurationService configurationService)
{
_configurationService = configurationService;
}
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
public bool IsUnderlyingThemeDark()
{
var currentTheme = _configurationService.Get(SelectedAppThemeKey, ApplicationElementTheme.Default);
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
if (currentTheme == ApplicationElementTheme.Default)
return uiSettings.GetColorValue(UIColorType.Background).ToString() == "#FF000000";
else
return currentTheme == ApplicationElementTheme.Dark;
2024-04-18 01:44:37 +02:00
}
}