Custom Theme issue
See original GitHub issueBug, feature request, or proposal:
Bug? Feature request?
What is the expected behavior?
Following this: https://github.com/angular/material2/blob/master/docs/theming.md#defining-a-custom-theme I should be able to introduce a custom the in my project.
Btw current themes (coming with the lib) are working fine. I’m only getting this error with custom themes.
What is the current behavior?
On the compile (angular-cli - webpack) I’m getting:
ERROR in ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/assets/styles/material-theme.sass
Module build failed:
$color: map-get($palette, $hue);
^
Argument `$map` of `map-get($map, $key)` must be a map
Backtrace:
node_modules/@angular/material/core/theming/_theming.scss:54, in function `map-get`
node_modules/@angular/material/core/theming/_theming.scss:54, in function `md-color`
node_modules/@angular/material/core/theming/_theming.scss:51, in function `md-color`
node_modules/@angular/material/core/ripple/_ripple.scss:68, in mixin `md-ripple-theme`
node_modules/@angular/material/core/_core.scss:26, in mixin `md-core-theme`
node_modules/@angular/material/core/theming/_all-theme.scss:26, in mixin `angular-material-theme`
stdin:23
in /Projects/Jexia/WebApp/node_modules/@angular/material/core/theming/_theming.scss (line 54, column 11)
@ ./src/assets/styles/material-theme.sass 4:14-185
@ multi styles
What are the steps to reproduce?
My current setup:
My custom theme:
@import '~@angular/material/core/theming/all-theme'
@import 'variables'
@include md-core()
$primary: '#fab700'
$accent: '#fab700'
$warn: md-palette($md-red)
$theme: md-light-theme($primary, $accent, $warn)
@include angular-material-theme($theme)
My angular-cli.json
(related part only):
"styles": [
"./assets/styles/material-theme.sass"
]
Which versions of Angular, Material, OS, browsers are affected?
Angular: 2.0.0
angular-cli: 1.0.0-beta.16
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (3 by maintainers)
Top Results From Across the Web
Product page issue with custom theme - WordPress.org
Hi, all. We have a custom theme and can't find a way to have the product page follow the same style as the...
Read more >10 Common WordPress Theme Issues & How To Fix Them
We address some of the most common WordPress theme issues and provide easy ... A lot of theme developers use custom page templates...
Read more >Custom Theme Not Working in Service
The custom theme that I have loaded into the report is reverting back to default values in the service. In the desktop my...
Read more >Audacity Custom Theme not working(Version 3.1.0) #2043
Only Custom themes aren't working , the other ones such as 'Classic' , 'Light' , 'Dark' , 'High Contrast' has NO issue. image....
Read more >Shopify theme & customization issues: The differences
All Shopify themes come with a base set of options that can be configured under the “Customize theme” menu accessible from the Themes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Your
$primary
,$accent
, etc. are not what the theme function is expecting. If you look at our pre-built themes as examples, you’ll see that it’s expecting one of the Material Design color palettes (such as$md-red
), not just a single color. If you create a map with the same structure it will work.For anyone that is worryed about how to create these palettes, you can use tools like mcg, example.