Skip to content

Instantly share code, notes, and snippets.

@tomastrajan
Last active November 29, 2018 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomastrajan/ccdfff221313bb436d242fcb9b5b8ac9 to your computer and use it in GitHub Desktop.
Save tomastrajan/ccdfff221313bb436d242fcb9b5b8ac9 to your computer and use it in GitHub Desktop.
Angular Material Theming - custom component theme
@import '~@angular/material/theming';
// mixin name will be used in main style.scss
@mixin big-input-component-theme($theme) {
// retrieve variables from theme
// (all possible variables, use only what you really need)
$primary: map-get($theme, primary);
$accent: map-get($theme, accent);
$warn: map-get($theme, accent);
$foreground: map-get($theme, foreground);
$background: map-get($theme, background);
// all of these variables contain many additional variables
big-input {
input {
// retrieve particular color from variable, rg: text, base, divider, ...
color: mat-color($foreground, text);
background-color: mat-color($background, card);
// or use "default" subvariable by default, oh the puns :)
border: 1px solid mat-color($accent);
}
}
}
@takahser
Copy link

there is a copy-paste error:

$warn: map-get($theme, accent); should be
$warn: map-get($theme, warn); instead.

@patilNik
Copy link

In _theming.scss file background color of status bar are define like this
$mat-light-theme-background: (
status-bar: map_get($mat-grey, 300),
..
)

$mat-dark-theme-background: (
status-bar: black,
..
)

I want to change the status bar color to white. How can I change it?
background-color: mat-color($background, status-bar);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment