import { Directive , HostBinding , Input , OnChanges } from '@angular/core' ; import { ThemeColor } from '@kirbydesign/core' ; @ Directive ( { selector : '[kirbyListItemColor]' , } ) export class ListItemColorDirective implements OnChanges { @ Input ( ) kirbyListItemColor : ( item : any ) => ThemeColor ; @ Input ( ) item : any ; @ HostBinding ( 'class' ) color : ThemeColor ; ngOnChanges ( ) { this . color = this . getColor ( ) ; } private getColor ( ) { if ( ! this . kirbyListItemColor || ! this . item ) { return ; } const themeColor = this . kirbyListItemColor ( this . item ) ; return themeColor ; } }