Change ion-option background color dynamically

I want to change ‘ion-option’ background color.

<ion-select name="color" [(ngModel)]="addItem.status">
   <ion-option  *ngFor="let color of colors" [value]="color.id"  [ngStyle]="{'background-color': color.code }">
      {{color.name}}
    </ion-option>
</ion-select>

also tried [style] attribute & inline stylesheet but didn’t work.

can anyone suggest how to change background color in ion-option that dependent on color object?

Also tried all solution from here but didn’t work any of them : Changing color and background color of ion-option

ionic info:

cordova (Cordova CLI) : 6.5.0
Ionic Framework : ionic-angular 3.6.1
@ionic/cli-utils : 1.15.2
ionic (Ionic CLI) : 3.15.2
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.0
ios-deploy : 1.9.2
ios-sim : 6.0.0
OS : macOS Sierra
Node : v8.1.1
npm : 5.0.3
Xcode : Xcode 9.0.1 Build version 9A1004

I had the same problem, could you solve it?

1 Like

No but achieved through radio buttons in modal.

I think, what you need is color selector using ion-select.
Please check this in my GitHub repository: https://github.com/ketanyekale/ionic-color-and-image-selector