首页 > 解决方案 > Ngx-color-picker 从输入中隐藏颜色值

问题描述

我正在使用这个颜色选择器来允许用户设置他的颜色。

有什么办法可以隐藏输入中的十六进制值而只保留背景颜色?

在此处输入图像描述

如果有更好的选择,我想避免使用 CSS

<input class="form-control"
     name="textSearchColor"
     [(colorPicker)]="textSearchColor"
     [style.background]="textSearchColor"
     [(ngModel)]="textSearchColor"
/>

标签: angularinputcolorscolor-picker

解决方案


我知道这有点晚了,但我想添加一个解决方案。只需将输入文本的颜色与背景颜色相同。

<input class="form-control"
     name="textSearchColor"
     [(colorPicker)]="textSearchColor"
     [style.background]="textSearchColor"
     [style.color]="textSearchColor" <----
     [(ngModel)]="textSearchColor"
/>


推荐阅读