2) (Unsolved) When the theme component is active If some changes are made to the theme manager on RBS these changes are reflected in RBS's design editor but it can not be active on the browser (even after published).
To reproduce the issue;
i) Open the Index.razor
ii) Change something on the selected theme, for example, swatches. This change will be reflected in the design editor.
iii) Save the page (not necessary).
iv) Run the project.
The design editor and the page on the browser will not be the same.
I couldn't find a solution.
*) I cleaned the bin and obj folders.
*) Cleand the browser cache.
etc. etc.
It is not clear how the Theme.razor component is used.
The theme editor saves the changes in the application css file (usually wwwroot/css/site.css). You can check if this is the case in your application. Look for
:root {
}
One thing to keep in mind - changes made to one theme will apply to every theme if you have dynamic theme switching. I am not sure if there is much sense of having both as changes made to a dark theme may look off in a light theme.
I prepared a simple example but I forgot to share it with you on my previous post. You can check it. There is nothing about site.css in this code. I think it's the same as what you did in your demo project. This code only changes the CSS file name.
I thought RBS does everything about CSS customization. It's not clear to me now. Is RBS changing only the site.css while the customization? If it's, is that meaning I can not create more than one customized theme using RBS?
In this case, the running application theme does not change because when the theme component is used the application access to original CSS file, not the site.css. Am I correct?
If it's, if I overwrite the site.css to the original CSS file when I made customizing can I manage this?
Yes. It uses CSS variables to customize the current theme. It cannot modify the CSS file of theme as some of them are embedded in the Radzen.Blazor nuget package and are read-only.
Yes, you cannot customize different themes. You can customize only the current one with RBS.
No. Both CSS files are included. The site.css file is included after the theme and thus can override the default CSS variables to change the theme.
If you customize a theme (for example by changing the primary color) this customization will apply to any other theme. Remember that RBS does not modify the theme CSS file e.g. material-base.css. It just sets CSS variables.
I don't think RBS supports out of the box what you are trying to do at the moment. If you want to customize some predefined themes you can create separate customization files for every theme (that contain that :root {} selector) and load them after the theme CSS file.
It's more clear now. But here is another question. What about the components? site.css root part keeps the main color declarations.
I'm asking because I'm using deeply customized CSS in my projects. I hope RBS makes easier this process for me.
The following sample is from RADZEN Studio age. This is reverse engineering work. I've created a sample page with Radzen components and then deep diving with developer tools. I wrote a separate CSS and override the originals. This is the long way to customizing.
I can be missing something. Sorry for that.
But how can I manage the following declarations with this root selector? There is no information about this component's values. Am I wrong?
This is a part of your theme manager and working well. Only I can not understand where is stored.
I share my apology one more time. Because I stole your time.
When you share the site.css file that overwrites the values of the original theme, I checked it and I've seen the color variables that are already changed by me. I've imagined, as a dumb, the root selector is a static section. But this section is dynamic as it must be. I had to beware of this.
If I understood your requirements correctly you want two things:
Ability for your users to change the theme. This is done via ThemeService and Theme.razor.
You want to customize all themes that your users can pick from.
If this is correct then read ahead.
The second point isn't directly supported. However you can create a separate css for every theme customization and paste there the :root {} selector from site.css which RBS will create when you customize a theme. Then you can load both the theme CSS file e.g. material-base.css and materal-base-custom.css from the Theme.razor.