Documentation
Customization

Theming

Since Fuse uses Angular Material as its primary UI library, it also uses the Angular Material Theming with a twist.

Rather than using Angular Material's default theming process, Fuse incorporates that into the Tailwind's build process. This way, you can configure your application using Tailwind's configuration file and things like colors, font families, breakpoints and etc. will be carried over and applied to the Angular Material components.

You can also create color themes using Tailwind's configuration and they will also be carried over and used for building Angular Material themes. Here's an example theme configuration from Tailwind's configuration:

Here's the general structure of a theme configuration:

Angular Material library uses 3 main color palettes and their contrasting colors to theme their components. Here we basically moved that configuration (in a customized and simplified way) into the Tailwind.

In order to have a complete understanding how Angular Material components are themed, you can check their official guides here: https://material.angular.io/guide/theming

Let's break down the 'default' theme configuration. This one is required for entire theming system and Fuse to work correctly:

Let's break down the rest of the theme configuration:

Color palettes

By default, Tailwind provides lots of color palettes so you can always use them to create themes.

If you have a different color that you want to use, like a brand color or a custom hand picked one, you must generate a Tailwind-like color palette in order to be able to generate themes with. There are couple ways of creating such palettes;

  1. You can create them by hand. Though this gives you complete freedom, it is by far the hardest one especially if you don't have any experience with colors and their relations.
  2. You can use online tools to generate Tailwind color palettes. They usually do a decent job for creating palettes but they could be a little off in some cases.
  3. You can use our custom generatePalette() helper method to create palettes either from a single color, or from multiple colors.

generatePalette()

This custom helper method allows you to generate Tailwind-like palettes from either a single color or multiple colors:

Usually, if you are working on an app by yourself, both designing and developing it, generating a complete Tailwind-like palette from a single color is a great option. But that's not always the case and most palette generators only give you an option to generate a palette using a single color. That becomes problematic if you have more than one color because then you would have to go through the generated palette and try to fit your remaining colors into it.

This is exactly where the generatePalette() method shines!

You can provide an object with multiple color levels and it will handle the rest for you. The best thing about the generatePalette() method is that it will actually respect the colors you choose. It will adjust the palette to make sure all the colors you provided will fit into it seamlessly.

Once you generate the palettes, you can use them to create color themes for your app.

Setting the default theme

By default, the "default" theme will be used as the default theme for your application. If for some reason, you want to have more than one themes and choose something other than the "default", you can do so by setting the default theme via app/core/config/app.config.ts file. You can also change the theme runtime using the FuseConfigService.

Schemes

Every color theme you configure will automatically have 2 schemes; Light and Dark. This way you can immediately change to a "dark" mode without losing your theme or setting up a separate "dark" theme.

You can set the default scheme via app/core/config/app.config.ts file. You can also change the scheme runtime using the FuseConfigService.

While you can set the scheme to "light" or "dark" you can also set it to "auto". "auto" mode will automatically switch between the "light" and "dark" schemes depending on the user's operating system's setting.