Posts

Showing posts from February, 2023

Light Mode and Dark Mode

Image
  Many of today’s websites provide the option to view a website in either a light mode or a dark mode. While other websites honor the system default to decide to use light mode or dark mode. Personally, I think a website should just use the system default. I can understand that a user might want to view your website in dark mode, or maybe they just want to view it in a different mode just once. If you prefer system default or allow the user to set the mode,   it is a nice feature to allow the user to switch to either dark or light mode. With Tailwind, this is a straightforward process.   How it works To implement the light-dark mode switch feature, a user simply clicks on a switch that selects which mode they want: Implementation There are five steps that must be implemented in other to support this feature.  1. In the TailwindCss configuration set the dark Mode under the Export modules to class. If this is not defined Tailwinds will use the system defau...

Brand New Default Blazor Templates

Image
 I have made the decision to switch to using TailwindCss for all my new projects because I really like  TailwindCss . It became a pain to have to clean out the Bootstrap and add the styling for the default pages each time I started a new project. My solution, create a new default Blazor default template that uses TailwindCss. Ways to create templates After some investigation, I discovered there are now two ways to create project templates for .Net. The original one where you use Visual Studio to token your project and then export it out. The second method is to use the template engine. Using Visual Studio is error-prone. Once you tokenize your project, it will not build anymore. You will have to keep two versions of the project and update each one moving forward. It does generate a zip file which makes it easier to share the new template. The new and better way, in my opinion, is to use the new template engine. Channel 9 has a good video series  on how it works. You use t...