Skip to content

Create custom theme #35

@n2lose

Description

@n2lose

Hi,

Do you have a doc or guide to instruct about custom theme?
I have followed theme guide to create a custom theme. I also checkout the showcase material2-app and check the material2-app-theme.scss.
But it seems doesn't work well as on demo :
When click the toggle button, it switch and change all the color md-primary, md-accent, md-warn, background to the colors of dark theme :

.m2app-dark {
  $dark-primary: md-palette($md-pink, 700, 500, 900);
  $dark-accent:  md-palette($md-blue-grey, A200, A100, A400);
  $dark-warn:    md-palette($md-deep-orange);

  $dark-theme: md-dark-theme($dark-primary, $dark-accent, $dark-warn);

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

What you did to import this scss file in the app? I just see in guide, we need to build this scss file to css and linked in the app.component.html.
Can i import it from stylesURLs in the app.component.ts instead of link in the html?
I have did imported in the app.component.ts, it seems doesn't work well. It just change the background color or main page, but it doesn't change the color of components as checkbox, radio, button,...
Here is my theme:

@import '~@angular/material/core/theming/_all-theme';

// Include non-theme styles for core.
@include md-core();

.default-theme {
  // Define a theme.
  $primary: md-palette($md-cyan, 500);
  $accent:  md-palette($md-amber, A200, A100, A400);
  $warn:    md-palette($md-deep-orange);

  // Create the theme object (a Sass map containing all of the palettes).
  $default-theme: md-light-theme($primary, $accent, $warn);
}

And here is the screen:
theme

Could show me how to change the all the color of components which has class md-primary, md-accent, md-warn,...?

Thanks,
Lam

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions