Angular Material 输入没有深色主题的白色文本
Angular Material Input does not have white text with dark theme
目前,我正在尝试使用 angular material 的深色主题。我遇到的问题是 matInput
颜色仍然是黑色。我将 mat-form-field
的颜色设置为原色。我仍在学习如何实现这些自定义主题,所以我可能没有正确理解它。我可以看到检查器中的 currentColor
变量是 black
。请注意,我不会覆盖项目中任何地方的颜色。我现在最多的css是自定义主题。
我也不想设置我的颜色 sass 我希望它自动使用主题前景色。
这是我的自定义主题sass:
@import '../node_modules/@angular/material/theming';
@include mat-core();
$md-skyblue: (
50 : #e5f2fd,
100 : #bfdefb,
200 : #95c8f8,
300 : #6ab1f5,
400 : #4aa1f2,
500 : #2a90f0,
600 : #2588ee,
700 : #1f7dec,
800 : #1973e9,
900 : #0f61e5,
A100 : #ffffff,
A200 : #dee9ff,
A400 : #abc8ff,
A700 : #91b7ff,
contrast: (
50 : #000000,
100 : #000000,
200 : #000000,
300 : #000000,
400 : #000000,
500 : #ffffff,
600 : #ffffff,
700 : #ffffff,
800 : #ffffff,
900 : #ffffff,
A100 : #000000,
A200 : #000000,
A400 : #000000,
A700 : #000000,
)
);
$dark-primary: mat-palette($md-skyblue, 700, 500, 900);
$dark-accent: mat-palette($mat-blue-grey, A200, A100, A400);
$dark-warn: mat-palette($mat-deep-orange);
$dark-theme: mat-dark-theme($dark-primary, $dark-accent, $dark-warn);
@include angular-material-theme($dark-theme);
$background: map-get($dark-theme, background);
body {
background-color: mat-color($background, background);
}
谢谢!
编辑:这是屏幕截图:
更新 -
几天来我第一次打开它,现在 mat-form-field
中的文本显示为白色。它可能只是侥幸,通过重建和提供应用程序,这次它以某种方式修复了自身。这很奇怪,因为当我最初发布此应用程序时,我保留了 运行 ng s
来重建应用程序,并且输入中的文本颜色保持黑色。
谢谢!
目前,我正在尝试使用 angular material 的深色主题。我遇到的问题是 matInput
颜色仍然是黑色。我将 mat-form-field
的颜色设置为原色。我仍在学习如何实现这些自定义主题,所以我可能没有正确理解它。我可以看到检查器中的 currentColor
变量是 black
。请注意,我不会覆盖项目中任何地方的颜色。我现在最多的css是自定义主题。
我也不想设置我的颜色 sass 我希望它自动使用主题前景色。
这是我的自定义主题sass:
@import '../node_modules/@angular/material/theming';
@include mat-core();
$md-skyblue: (
50 : #e5f2fd,
100 : #bfdefb,
200 : #95c8f8,
300 : #6ab1f5,
400 : #4aa1f2,
500 : #2a90f0,
600 : #2588ee,
700 : #1f7dec,
800 : #1973e9,
900 : #0f61e5,
A100 : #ffffff,
A200 : #dee9ff,
A400 : #abc8ff,
A700 : #91b7ff,
contrast: (
50 : #000000,
100 : #000000,
200 : #000000,
300 : #000000,
400 : #000000,
500 : #ffffff,
600 : #ffffff,
700 : #ffffff,
800 : #ffffff,
900 : #ffffff,
A100 : #000000,
A200 : #000000,
A400 : #000000,
A700 : #000000,
)
);
$dark-primary: mat-palette($md-skyblue, 700, 500, 900);
$dark-accent: mat-palette($mat-blue-grey, A200, A100, A400);
$dark-warn: mat-palette($mat-deep-orange);
$dark-theme: mat-dark-theme($dark-primary, $dark-accent, $dark-warn);
@include angular-material-theme($dark-theme);
$background: map-get($dark-theme, background);
body {
background-color: mat-color($background, background);
}
谢谢!
编辑:这是屏幕截图:
更新 -
几天来我第一次打开它,现在 mat-form-field
中的文本显示为白色。它可能只是侥幸,通过重建和提供应用程序,这次它以某种方式修复了自身。这很奇怪,因为当我最初发布此应用程序时,我保留了 运行 ng s
来重建应用程序,并且输入中的文本颜色保持黑色。
谢谢!