Skip to content

Latest commit

 

History

History
64 lines (46 loc) · 1.43 KB

STEP_7.md

File metadata and controls

64 lines (46 loc) · 1.43 KB

Quick Jump

Step #7 Task:

Add themes with the theming mixins provided by Material.

File: src/theme.scss
@import '~@angular/material/_theming';

@include mat-core();

$primary: mat-palette($mat-red);
$accent: mat-palette($mat-blue);

$theme: mat-light-theme($primary, $accent);

@include angular-material-theme($theme);

You can choose your palettes out of the Material Design Color Palettes spec

Tell angular-cli to also compile the themes file, because angular-cli uses webpack, The Angular CLI has a built-in plugin to compile scss for us, so all we have to do is include it in the styles section.

File: angular-cli.json
{
  "apps": [
    {
      "styles": [
        "styles.css",
        "theme.scss"
      ]
    }
  ]
}

The prebuilt theme that has been included in Step 1 is now unused and can be deleted.

Tips

1. Angular CLI

The Angular CLI won't notice the changes in the angular-cli.json file. Restarting the serve task will do the trick.


Go to Tutorial Step 8