Theming my own components (Alpha 9)
See original GitHub issueBug, feature request, or proposal:
Attempting to follow the guidelines for styling my own components based on Material, but simply can’t get it to work, I am doing the following in the scss but it does not work. Importing theming and palette into my scss results in $primary not being found. What could I be doing wrong ? Am I not importing correctly ? How do I correctly import theming in my scss such that I can theme my own components.
At the top of my scss
@import 'node_modules/@angular/material/core/theming/_theming';
.someClass { background-color: md-color($primary); color: md-color($primary, default-contrast); // color: red; }
Then I get the following on compiling the SASS
Error: Undefined variable: “$primary”
Need Help
What is the expected behavior?
Need to be able to correctly theme my own components using material import via my scss
What is the current behavior?
Can’t find $primary
What are the steps to reproduce?
Tried to pull together a plunker based on a material seed, find it here
The plunker simply will not render if the code in myComp.component.scss remains as is, if the component theming is removed with the import commented and simply setting the color to red, the page will render correctly ???
What is the use-case or motivation for changing an existing behavior?
Styling my own components based on material
Which versions of Angular, Material, OS, browsers are affected?
Ng 2.0 final Material Alpha 9
Is there anything else we should know?
no
Issue Analytics
- State:
- Created 7 years ago
- Comments:26 (10 by maintainers)
Top GitHub Comments
Also believe this to be related #887
@dahaupt so are you saying that I need to create my own theme in order to theme my own components ? This is not my interpretation of the md file ! It reads as if all I need to do is import theming support and use the existing parameters ? If all I want to do is use an existing prebuilt theme and tap into the existing $primary palette how is this achievable. I do not agree that we should have to create a new theme, can we not simply apply an existing one and how do we do this ?