$mdThemingProvider backgroundPalette does not theme the background
I configure the theme provider as follows:
$mdThemingProvider
.theme('default')
.primaryPalette('deep-orange', {
'default': '900',
'hue-2': '500'
})
.backgroundPalette('grey', {
'default': '200'
})
.accentPalette('orange');
But the background remain's white
It would be really great to have this working.
@rschmukler - any interim thoughts while we resolve this for 0.9.x ?
it takes the 'A100' value when you set the backgroundPalette, so maybe an easy workaround will be that you can put the background color on the 'A100' while this get fix... what do u think?
@blackendstudios that trick helped me, but I rather use something less "hacky", so I'll just :+1: this issue.
ohhhh glad that helped...it was my firts contribution on git hubjajajaja ...great...hope to help more in the future
:+1:
This issue is similar to #1321 . The reason why it takes the 'A100' value always is because it is the default color for 'hue-3'.
Below is the excerpt from theming.js
THEME_COLOR_TYPES.forEach(function(colorType) {
// Color types with unspecified default hues will use these default hue values
var defaultDefaultHues = {
'default': '500',
'hue-1': '300',
'hue-2': '800',
'hue-3': 'A100'
};
if (!LIGHT_DEFAULT_HUES[colorType]) LIGHT_DEFAULT_HUES[colorType] = defaultDefaultHues;
if (!DARK_DEFAULT_HUES[colorType]) DARK_DEFAULT_HUES[colorType] = defaultDefaultHues;
});
And after digging in the code i found that the theme sass files for components have hard coded background color as:
md-content.md-THEME_NAME-theme {
background-color: '{{background-hue-3}}';
}
The above example is from content-theme.scss. Similar mention is also found in other theme files like dialog-theme.scss, sidenav-theme.scss, slider-theme.scss and subheader-theme.scss.
The solution that i propose for this is something like this
md-content.md-THEME_NAME-theme {
background-color: '{{background-color}}';
}
This has started working for me in my local build. But i guess the solution would be more comprehensive - providing background capabilities in a more generic manner. Just putting it out there. Hope it helps
@blackendstudios Do you change the 'A100' value on primaryPalette or accentPalette?
@dpipkin it is on backgroundPalette
backgroundPalette :)
Awesome! Thank you.
The hacky way that I made it work:
var background = $mdThemingProvider.extendPalette('grey', {
'A100': 'f2f2f2'
});
$mdThemingProvider.definePalette('background', background);
$mdThemingProvider.theme('default')
...
.backgroundPalette('background');
I hope that isn't too roundabout.
@dpipkin that is the proper way to achieve this. Waiting on #1950 to see if a clearer way emerges from it.
Closing this issue for now, but follow #1950 to see a potential enhancement