Material 15更改颜色输入元素日期选择器



我需要你的帮助来改变白色的输入日期和下划线在一个日期拾取器元素

<mat-form-field class="date-criteria-select " [floatLabel]="'always'">
<mat-label class="upside-label">{{label}}</mat-label>
<input matInput [matDatepicker]="picker" [min] = "minDate" [max] = "maxDate" [(ngModel)] = "date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>

我尝试了很多css技巧

.mat-form-field-underline {
/*change color of underline*/
color: white !important;
}

.mat-input-element {
color: white;
}

.mat-datepicker-content {
color: white;
}

唯一有效的方法是设置style="color:white;"输入标签

你需要知道如何创建"line">

。在材料15中,appearance="fill"与

有关
.mdc-text-field--filled:not(.mdc-text-field--disabled) .mdc-line-ripple::before {
border-bottom-color: #0000006b;
}
//and
.mdc-text-field--filled .mdc-line-ripple::after {
border-bottom-color: var(--mdc-theme-primary, #3f51b5);
}
//the color of the input is
@media all
.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__input::placeholder {
color: red;
}

谢谢你,这解决了我的问题

.mdc-line-ripple::before {
background-color: white!important;
}

最新更新