问题描述
我现在尝试了几个小时.我使用Material2,只是想更改进度条的颜色.我知道有这些主题(主要/重音/警告),但我想在进度栏上使用柔和的颜色(绿色).
I am now trying for hours. I use Material2 and simply want to change the color of the progress-bar. I know there are those themes (primary/accent/warn) but I want to have a cutom color (green) for my progressbar.
我已经尝试了最奇怪的css-combinations.也许有人遇到同样的问题?
I already tried the wierdest css-combinations.. but with no effort. Maybe someone had the same problem?
推荐答案
我建议将一种预制的原色/警告色/强调色更改为您的自定义颜色.
I can suggest to change one of the premade primary/warn/accent colors to your custom color.
在您的styles.scss
中(如果样式文件是css,则必须对其进行更改以支持scss):
In your styles.scss
(if your style file is css you will have to change it to support scss):
@import '~@angular/material/theming';
// Plus imports for other components in your app.
// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// Be sure that you only ever include this mixin once!
@include mat-core();
// Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker
// hue.
$mat-blue: (
50: #e3f2fd,
100: #bbdefb,
200: #90caf9,
300: #64b5f6,
400: #42a5f5,
500: #2196f3,
600: #1e88e5,
700: #1976d2,
800: #1565c0,
900: #0d47a1,
A100: #82b1ff,
A200: #448aff,
A400: #2979ff,
A700: #2B66C3,
contrast: (
50: $black-87-opacity,
100: $black-87-opacity,
200: $black-87-opacity,
300: $black-87-opacity,
400: $black-87-opacity,
500: white,
600: white,
700: white,
800: $white-87-opacity,
900: $white-87-opacity,
A100: $black-87-opacity,
A200: white,
A400: white,
A700: white,
)
);
$candy-app-primary: mat-palette($mat-blue, A700);
$candy-app-accent: mat-palette($mat-orange, A200, A100, A400);
// The warn palette is optional (defaults to red).
$candy-app-warn: mat-palette($mat-red);
// Create the theme object (a Sass map containing all of the palettes).
$candy-a-theme($candy-app-theme);
pp-theme: mat-light-theme($candy-app-primary, $candy-app-accent, $candy-app-warn);
// Include theme styles for core and each component used in your app.
// Alternatively, you can import and @include the theme mixins for each component
// that you are using.
@include angular-material
这篇关于角度-材质:Progressbar自定义颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!