Added theming support. Added import/export

Missing: API Server save
This commit is contained in:
2025-01-08 00:33:09 +01:00
parent e299cde6da
commit 1a4864ba00
10 changed files with 424 additions and 33 deletions

View File

@@ -0,0 +1,25 @@
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();
}
}