Angular Material cant change background color with theme
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I've been tring to make a custom theme for my site but nothing will effect the background color. This is my theme:
@import '~@angular/material/theming';
@include mat-core();
$warn: mat-palette($mat-red);
$dark-primary: mat-palette($mat-grey, 900);
$dark-accent: mat-palette($mat-grey);
$dark-theme: mat-dark-theme($dark-primary, $dark-accent, $warn);
@include angular-material-theme($dark-theme);
$blue-primary: mat-palette($mat-indigo, 800, 100, 100);
$blue-accent: mat-palette($mat-grey, 300, 100, 500);
$blue-theme: mat-light-theme($blue-primary, $blue-accent, $warn);
.alt-theme {
@include angular-material-theme($blue-theme);
}
I have mat-app-background
on my body but what ever the first included theme is set to dark/light that is what the background color is changed too, black or white.
This was a problem at first but I'm fine with that my issue now is that it doesnt care that the alt-theme is light, the background stays black. Or if the first included theme is light and the alt is dark it will stay white.
EDIT:
So my issue was that I was adding the class to my mat-drawer-container
which I guess it doesnt like, I wrapped it in a div and then everything started working as expected
angular angular-material material-design material-theme angular-material-theming
add a comment |
I've been tring to make a custom theme for my site but nothing will effect the background color. This is my theme:
@import '~@angular/material/theming';
@include mat-core();
$warn: mat-palette($mat-red);
$dark-primary: mat-palette($mat-grey, 900);
$dark-accent: mat-palette($mat-grey);
$dark-theme: mat-dark-theme($dark-primary, $dark-accent, $warn);
@include angular-material-theme($dark-theme);
$blue-primary: mat-palette($mat-indigo, 800, 100, 100);
$blue-accent: mat-palette($mat-grey, 300, 100, 500);
$blue-theme: mat-light-theme($blue-primary, $blue-accent, $warn);
.alt-theme {
@include angular-material-theme($blue-theme);
}
I have mat-app-background
on my body but what ever the first included theme is set to dark/light that is what the background color is changed too, black or white.
This was a problem at first but I'm fine with that my issue now is that it doesnt care that the alt-theme is light, the background stays black. Or if the first included theme is light and the alt is dark it will stay white.
EDIT:
So my issue was that I was adding the class to my mat-drawer-container
which I guess it doesnt like, I wrapped it in a div and then everything started working as expected
angular angular-material material-design material-theme angular-material-theming
Are you appling the .alt-theme css class to any component or to your html body? You are just including the dark-theme. If you want to activate the .alt-theme you have to use an overlay i think
– maerlin
Nov 16 '18 at 14:07
Yes I am applying the class.
– amedeiros
Nov 16 '18 at 14:08
The issue is isnt that the theme isnt being applied the issue is that when it does get applied the background color doesnt change with it
– amedeiros
Nov 16 '18 at 14:17
add a comment |
I've been tring to make a custom theme for my site but nothing will effect the background color. This is my theme:
@import '~@angular/material/theming';
@include mat-core();
$warn: mat-palette($mat-red);
$dark-primary: mat-palette($mat-grey, 900);
$dark-accent: mat-palette($mat-grey);
$dark-theme: mat-dark-theme($dark-primary, $dark-accent, $warn);
@include angular-material-theme($dark-theme);
$blue-primary: mat-palette($mat-indigo, 800, 100, 100);
$blue-accent: mat-palette($mat-grey, 300, 100, 500);
$blue-theme: mat-light-theme($blue-primary, $blue-accent, $warn);
.alt-theme {
@include angular-material-theme($blue-theme);
}
I have mat-app-background
on my body but what ever the first included theme is set to dark/light that is what the background color is changed too, black or white.
This was a problem at first but I'm fine with that my issue now is that it doesnt care that the alt-theme is light, the background stays black. Or if the first included theme is light and the alt is dark it will stay white.
EDIT:
So my issue was that I was adding the class to my mat-drawer-container
which I guess it doesnt like, I wrapped it in a div and then everything started working as expected
angular angular-material material-design material-theme angular-material-theming
I've been tring to make a custom theme for my site but nothing will effect the background color. This is my theme:
@import '~@angular/material/theming';
@include mat-core();
$warn: mat-palette($mat-red);
$dark-primary: mat-palette($mat-grey, 900);
$dark-accent: mat-palette($mat-grey);
$dark-theme: mat-dark-theme($dark-primary, $dark-accent, $warn);
@include angular-material-theme($dark-theme);
$blue-primary: mat-palette($mat-indigo, 800, 100, 100);
$blue-accent: mat-palette($mat-grey, 300, 100, 500);
$blue-theme: mat-light-theme($blue-primary, $blue-accent, $warn);
.alt-theme {
@include angular-material-theme($blue-theme);
}
I have mat-app-background
on my body but what ever the first included theme is set to dark/light that is what the background color is changed too, black or white.
This was a problem at first but I'm fine with that my issue now is that it doesnt care that the alt-theme is light, the background stays black. Or if the first included theme is light and the alt is dark it will stay white.
EDIT:
So my issue was that I was adding the class to my mat-drawer-container
which I guess it doesnt like, I wrapped it in a div and then everything started working as expected
angular angular-material material-design material-theme angular-material-theming
angular angular-material material-design material-theme angular-material-theming
edited Nov 16 '18 at 15:03
amedeiros
asked Nov 16 '18 at 14:02
amedeirosamedeiros
677
677
Are you appling the .alt-theme css class to any component or to your html body? You are just including the dark-theme. If you want to activate the .alt-theme you have to use an overlay i think
– maerlin
Nov 16 '18 at 14:07
Yes I am applying the class.
– amedeiros
Nov 16 '18 at 14:08
The issue is isnt that the theme isnt being applied the issue is that when it does get applied the background color doesnt change with it
– amedeiros
Nov 16 '18 at 14:17
add a comment |
Are you appling the .alt-theme css class to any component or to your html body? You are just including the dark-theme. If you want to activate the .alt-theme you have to use an overlay i think
– maerlin
Nov 16 '18 at 14:07
Yes I am applying the class.
– amedeiros
Nov 16 '18 at 14:08
The issue is isnt that the theme isnt being applied the issue is that when it does get applied the background color doesnt change with it
– amedeiros
Nov 16 '18 at 14:17
Are you appling the .alt-theme css class to any component or to your html body? You are just including the dark-theme. If you want to activate the .alt-theme you have to use an overlay i think
– maerlin
Nov 16 '18 at 14:07
Are you appling the .alt-theme css class to any component or to your html body? You are just including the dark-theme. If you want to activate the .alt-theme you have to use an overlay i think
– maerlin
Nov 16 '18 at 14:07
Yes I am applying the class.
– amedeiros
Nov 16 '18 at 14:08
Yes I am applying the class.
– amedeiros
Nov 16 '18 at 14:08
The issue is isnt that the theme isnt being applied the issue is that when it does get applied the background color doesnt change with it
– amedeiros
Nov 16 '18 at 14:17
The issue is isnt that the theme isnt being applied the issue is that when it does get applied the background color doesnt change with it
– amedeiros
Nov 16 '18 at 14:17
add a comment |
1 Answer
1
active
oldest
votes
I usually add variables like these:
$mat-light-theme-background: (
status-bar: map_get($mat-grey, 300),
app-bar: map_get($mat-grey, 100),
background: map_get($mat-grey, A100),
hover: rgba(black, 0.04), // TODO(kara): check style with Material Design UX
card: white,
dialog: white,
disabled-button: $black-12-opacity,
raised-button: white,
focused-button: $black-6-opacity,
selected-button: map_get($mat-grey, 300),
selected-disabled-button: map_get($mat-grey, 400),
disabled-button-toggle: map_get($mat-grey, 200),
unselected-chip: map_get($mat-grey, 300),
disabled-list-option: map_get($mat-grey, 200),
);
$mat-light-theme-foreground: (
base: black,
divider: $dark-dividers,
dividers: $dark-dividers,
disabled: $dark-disabled-text,
disabled-button: rgba(black, 0.26),
disabled-text: $dark-disabled-text,
hint-text: $dark-disabled-text,
secondary-text: $dark-secondary-text,
icon: rgba(black, 0.54),
icons: rgba(black, 0.54),
text: rgba(black, 0.87),
slider-min: rgba(black, 0.87),
slider-off: rgba(black, 0.26),
slider-off-active: rgba(black, 0.38),
);
// Create the theme object (a Sass map containing all of the palettes).
$material-theme: mat-light-theme($primary, $accent, $warn);
How do you apply the foreground and background? I did try just adding the code to my scss file but nothing changed
– amedeiros
Nov 16 '18 at 14:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339350%2fangular-material-cant-change-background-color-with-theme%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I usually add variables like these:
$mat-light-theme-background: (
status-bar: map_get($mat-grey, 300),
app-bar: map_get($mat-grey, 100),
background: map_get($mat-grey, A100),
hover: rgba(black, 0.04), // TODO(kara): check style with Material Design UX
card: white,
dialog: white,
disabled-button: $black-12-opacity,
raised-button: white,
focused-button: $black-6-opacity,
selected-button: map_get($mat-grey, 300),
selected-disabled-button: map_get($mat-grey, 400),
disabled-button-toggle: map_get($mat-grey, 200),
unselected-chip: map_get($mat-grey, 300),
disabled-list-option: map_get($mat-grey, 200),
);
$mat-light-theme-foreground: (
base: black,
divider: $dark-dividers,
dividers: $dark-dividers,
disabled: $dark-disabled-text,
disabled-button: rgba(black, 0.26),
disabled-text: $dark-disabled-text,
hint-text: $dark-disabled-text,
secondary-text: $dark-secondary-text,
icon: rgba(black, 0.54),
icons: rgba(black, 0.54),
text: rgba(black, 0.87),
slider-min: rgba(black, 0.87),
slider-off: rgba(black, 0.26),
slider-off-active: rgba(black, 0.38),
);
// Create the theme object (a Sass map containing all of the palettes).
$material-theme: mat-light-theme($primary, $accent, $warn);
How do you apply the foreground and background? I did try just adding the code to my scss file but nothing changed
– amedeiros
Nov 16 '18 at 14:16
add a comment |
I usually add variables like these:
$mat-light-theme-background: (
status-bar: map_get($mat-grey, 300),
app-bar: map_get($mat-grey, 100),
background: map_get($mat-grey, A100),
hover: rgba(black, 0.04), // TODO(kara): check style with Material Design UX
card: white,
dialog: white,
disabled-button: $black-12-opacity,
raised-button: white,
focused-button: $black-6-opacity,
selected-button: map_get($mat-grey, 300),
selected-disabled-button: map_get($mat-grey, 400),
disabled-button-toggle: map_get($mat-grey, 200),
unselected-chip: map_get($mat-grey, 300),
disabled-list-option: map_get($mat-grey, 200),
);
$mat-light-theme-foreground: (
base: black,
divider: $dark-dividers,
dividers: $dark-dividers,
disabled: $dark-disabled-text,
disabled-button: rgba(black, 0.26),
disabled-text: $dark-disabled-text,
hint-text: $dark-disabled-text,
secondary-text: $dark-secondary-text,
icon: rgba(black, 0.54),
icons: rgba(black, 0.54),
text: rgba(black, 0.87),
slider-min: rgba(black, 0.87),
slider-off: rgba(black, 0.26),
slider-off-active: rgba(black, 0.38),
);
// Create the theme object (a Sass map containing all of the palettes).
$material-theme: mat-light-theme($primary, $accent, $warn);
How do you apply the foreground and background? I did try just adding the code to my scss file but nothing changed
– amedeiros
Nov 16 '18 at 14:16
add a comment |
I usually add variables like these:
$mat-light-theme-background: (
status-bar: map_get($mat-grey, 300),
app-bar: map_get($mat-grey, 100),
background: map_get($mat-grey, A100),
hover: rgba(black, 0.04), // TODO(kara): check style with Material Design UX
card: white,
dialog: white,
disabled-button: $black-12-opacity,
raised-button: white,
focused-button: $black-6-opacity,
selected-button: map_get($mat-grey, 300),
selected-disabled-button: map_get($mat-grey, 400),
disabled-button-toggle: map_get($mat-grey, 200),
unselected-chip: map_get($mat-grey, 300),
disabled-list-option: map_get($mat-grey, 200),
);
$mat-light-theme-foreground: (
base: black,
divider: $dark-dividers,
dividers: $dark-dividers,
disabled: $dark-disabled-text,
disabled-button: rgba(black, 0.26),
disabled-text: $dark-disabled-text,
hint-text: $dark-disabled-text,
secondary-text: $dark-secondary-text,
icon: rgba(black, 0.54),
icons: rgba(black, 0.54),
text: rgba(black, 0.87),
slider-min: rgba(black, 0.87),
slider-off: rgba(black, 0.26),
slider-off-active: rgba(black, 0.38),
);
// Create the theme object (a Sass map containing all of the palettes).
$material-theme: mat-light-theme($primary, $accent, $warn);
I usually add variables like these:
$mat-light-theme-background: (
status-bar: map_get($mat-grey, 300),
app-bar: map_get($mat-grey, 100),
background: map_get($mat-grey, A100),
hover: rgba(black, 0.04), // TODO(kara): check style with Material Design UX
card: white,
dialog: white,
disabled-button: $black-12-opacity,
raised-button: white,
focused-button: $black-6-opacity,
selected-button: map_get($mat-grey, 300),
selected-disabled-button: map_get($mat-grey, 400),
disabled-button-toggle: map_get($mat-grey, 200),
unselected-chip: map_get($mat-grey, 300),
disabled-list-option: map_get($mat-grey, 200),
);
$mat-light-theme-foreground: (
base: black,
divider: $dark-dividers,
dividers: $dark-dividers,
disabled: $dark-disabled-text,
disabled-button: rgba(black, 0.26),
disabled-text: $dark-disabled-text,
hint-text: $dark-disabled-text,
secondary-text: $dark-secondary-text,
icon: rgba(black, 0.54),
icons: rgba(black, 0.54),
text: rgba(black, 0.87),
slider-min: rgba(black, 0.87),
slider-off: rgba(black, 0.26),
slider-off-active: rgba(black, 0.38),
);
// Create the theme object (a Sass map containing all of the palettes).
$material-theme: mat-light-theme($primary, $accent, $warn);
answered Nov 16 '18 at 14:04
CarstenCarsten
2,089919
2,089919
How do you apply the foreground and background? I did try just adding the code to my scss file but nothing changed
– amedeiros
Nov 16 '18 at 14:16
add a comment |
How do you apply the foreground and background? I did try just adding the code to my scss file but nothing changed
– amedeiros
Nov 16 '18 at 14:16
How do you apply the foreground and background? I did try just adding the code to my scss file but nothing changed
– amedeiros
Nov 16 '18 at 14:16
How do you apply the foreground and background? I did try just adding the code to my scss file but nothing changed
– amedeiros
Nov 16 '18 at 14:16
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339350%2fangular-material-cant-change-background-color-with-theme%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you appling the .alt-theme css class to any component or to your html body? You are just including the dark-theme. If you want to activate the .alt-theme you have to use an overlay i think
– maerlin
Nov 16 '18 at 14:07
Yes I am applying the class.
– amedeiros
Nov 16 '18 at 14:08
The issue is isnt that the theme isnt being applied the issue is that when it does get applied the background color doesnt change with it
– amedeiros
Nov 16 '18 at 14:17