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,43 @@
@using Moonlight.Client.Services
@inject ThemeService ThemeService
@implements IDisposable
<style>
:root {
@Css
}
</style>
@code
{
private string Css = "";
protected override void OnInitialized()
{
GenerateCss();
ThemeService.OnRefresh += OnRefresh;
}
private async Task OnRefresh()
{
GenerateCss();
await InvokeAsync(StateHasChanged);
}
private void GenerateCss()
{
Css = "";
foreach (var variable in ThemeService.Variables)
Css += $"--color-{variable.Key}: {variable.Value};\n";
}
public void Dispose()
{
ThemeService.OnRefresh -= OnRefresh;
}
}