Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change default theme in angular material

how can change default theme in angular material?

For change from indigo-pink.css to purple-green.css

In angular.json I change from

 "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "./node_modules/bootstrap/dist/css/bootstrap.min.css",
              "src/styles.css"
            ]

to

 "styles": [
              "./node_modules/@angular/material/prebuilt-themes/purple-green.css",
              "./node_modules/bootstrap/dist/css/bootstrap.min.css",
              "src/styles.css"
            ]

But after changing the style, materials element are not displayed...

I import css but still does not show material element. enter image description here please help me

like image 665
ashkufaraz Avatar asked Jul 02 '26 00:07

ashkufaraz


1 Answers

In angular 8 we must create src\styles.scss file with

@import '@angular/material/prebuilt-themes/purple-green.css';

Then add styles.scss to angular.json like this

"styles": ["src/styles.scss"]
like image 139
ashkufaraz Avatar answered Jul 04 '26 13:07

ashkufaraz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!