Files
Moonlight/Moonlight.Client/Services/ThemeService.cs
2025-01-08 00:33:09 +01:00

25 lines
631 B
C#

using MoonCore.Attributes;
using Moonlight.Shared.Misc;
namespace Moonlight.Client.Services;
[Singleton]
public class ThemeService
{
public event Func<Task> OnRefresh;
public Dictionary<string, string> Variables { get; private set; } = new();
public ThemeService(FrontendConfiguration configuration)
{
// Load theme variables into the cache
foreach (var themeVariable in configuration.Theme.Variables)
Variables[themeVariable.Key] = themeVariable.Value;
}
public async Task Refresh()
{
if (OnRefresh != null)
await OnRefresh.Invoke();
}
}