I use ionic 4 and trying to change background-color ion-select-option.
html.
<div *ngIf="listName.checked" class="colorselect color_{{color.slice(1,7)}}">
<ion-select (click)="prepareColorSelector()" (ionChange)="setColor(this.color,i)" [(ngModel)]="color">
<ion-select-option (ionSelect)="selectColor(optioncolor)" *ngFor="let optioncolor of colors" [value]="optioncolor" style="background-color:optioncolor">{{optioncolor}}</ion-select-option>
</ion-select>
</div>
scss.
.colorselect {
.select-text {
width: 75px;
border-radius: 5px;
}
.alert-radio-inner,
.alert-radio-icon,
.alert-radio-label {
display: none;
}
&.colorselected:before {
content: '\2713';
color: white;
z-index: 999999;
width: 100%;
height: 100%;
font-size: 33px;
left: 50%;
top: 50%;
position: relative;
transform: translate(-50%);
}
$colorsToSelect: "#d435a2" "#a834bf" "#6011cf" "#0d0e81";
@each $colorOption in $colorsToSelect {
$colorWithoutHash: str-slice($colorOption, 2, 7);
&.color_#{$colorWithoutHash} {
&, & .select-text {
color: #{$colorOption};
background-color: #{$colorOption};
}
}
}
}
The background-color can't change. this problem only with ion-select-option.someone can help me.