I've set the onclick event for an element to @onclick="changeTheme".
The event is fired, but the following code to change the theme to dark, executes, but does not change the theme to dark as expected?
@code {
private void changeTheme()
{
KTTheme.SetModeDefault("dark");
}
}
I'm using Blazer Starterkit, latest version!
Hi,
Sorry for the late reply.
The SetModeDefault
sets the default mode only. You can set dark mode using KTThemeMode.setMode javascript function as shown below.
<button @onclick="setDarkMode">Dark</button>
@code {
private void setDarkMode()
{
JS.InvokeVoidAsync("KTThemeMode.setMode", "dark");
}
}