I am encountering an issue with the styling of a standard matInput field within a mat-form-field, all contained within a [formGroup] div. The dark background of the parent element is causing visibility problems with the default dark text color of the input field. Here's a snippet of the HTML code:
<div [formGroup]="myInfo">
Year:
<mat-form-field>
<input class="myClass" style="color: white" matInput (keypress)="numericOnly($event)" placeholder='YYYY'
formControlName="yearControl">
</mat-form-field>
</div>
After researching online and following some advice, I made changes in the .scss file like so:
.childClass {
input { color: #fff !important; }
label.mat-input-placeholder { color: #fff !important; }
::ng-deep .mat-form-field-label { color: #fff !important; }
::ng-deep .mat-form-field-ripple { color: #fff !important; }
::ng-deep .mat-form-field-underline { color: #fff !important; }
}
While this successfully updated the placeholder and entered text to white, the underline remained black. Any further suggestions would be greatly appreciated. Thank you.