chanan / BlazorStyled

CSS in Blazor Components
https://blazorstyled.io
The Unlicense
191 stars 19 forks source link

Feature Proposal: Theme Tag #78

Open chanan opened 4 years ago

chanan commented 4 years ago

Themes need some TLC... Maybe the ability to define a theme inside a tag will help something along the lines:

<Theme Name="MyTheme">
  colors.background: red;
</Theme>

or maybe json would be better?

<Theme Name="MyTheme">
{
  colors: {
    background: "red"
  }
}
</Theme>

HOCON could allow both syntaxes: https://github.com/akkadotnet/HOCON

The API will be updated to allow a theme update in one string:

IStyled.AddTheme("MyTheme", themeJsonOrString);

Lastly, need to add a way to switch between themes. API:

IStyled.SetTheme("MyTheme");

Not sure about a Tag version for that. Maybe:

<Theme SetTheme="MyTheme />