Open saberpooyan opened 1 year ago
@Garderoben @JonBunator ?
This won't work because MudTheme
requires the more generic Palette
class. You can override the theme provider instead:
public class MyOwnThemeProvider : MudThemeProvider
{
protected override void GenerateTheme(StringBuilder theme)
{
base.GenerateTheme(theme);
if(base.IsDarkMode == true)
{
theme.AppendLine($"--mud-palette-ForegroundColor {new MudColor("#dd5858")};");
}
else
{
theme.AppendLine($"--mud-palette-ForegroundColor: red;");
}
}
}
But imo it should be possible to add custom variables without overriding the theme provider. See https://github.com/MudBlazor/MudBlazor/discussions/6148
Thank you for your guidance.
Hi i'm going to add some property attributes to mud palette so I created new class as you can see in the picture: and then I used that in PresetThemes.cs class like this Now as a result I can see my property in c# code but I can't use it as a CSS variable like this var(--mud-palette-ForegroundColor). How can i solve this problem?