2017-05-23 6 views
1

次のアクションシートに埋め込まれているカスタムアイコン(IcoMoonで生成)の色を変更したいとします。私はイオンFrameworkのバージョンで働いています:アクションシートのカスタムアイコンの色をイオン性に変更するにはどうすればいいですか?

groups.html

. 
. 
. 
<ion-card> 

    <img src="../../assets/img/groups/acoustics group.jpg"/> 

    <ion-card-content> 
     <ion-card-title> 
      <ion-row> 
       <ion-col class="settitle"> 
        Acoustics 
       </ion-col> 
       <ion-col class="rightcol"> 
        <button class="iconmore" ion-button clear icon-only small (click)="openMenuGroup()" round> 
         <ion-icon name="more" ></ion-icon> 
        </button> 
       </ion-col> 
      </ion-row> 
     </ion-card-title> 
     <p class="content"> 
      22 Bookings <br> 
      Since December 23th 2016 
     </p> 
    </ion-card-content> 

</ion-card> 
. 
. 
. 

グループ:3.1.1

enter image description here

これは、ビューに関連する3つのファイルを見てどのようです.ts

. 
. 
. 
openMenuGroup() { 
    let actionSheet = this.actionsheetCtrl.create({ 
     title: 'More', 
     cssClass: 'action-sheets-groups-page', 
     buttons: [ 
      { 
       text: 'Edit', 
       icon: 'icon-edition', 
       handler:() => { 
        console.log('Edit clicked'); 
       } 
      }, 
      { 
       text: 'Delete', 
       role: 'destructive', 
       icon: 'icon-erase', 
       handler:() => { 
        console.log('Delete clicked'); 
       } 
      },    
      { 
       text: 'Cancel', 
       role: 'cancel', // will always sort to be on the bottom 
       icon: 'close', 
       handler:() => { 
        console.log('Cancel clicked'); 
       } 
      } 
     ] 
    }); 
    actionSheet.present(); 
} 
. 
. 
. 

groups.css

page-groups { 

    ion-content{ 

     .settitle{ 
      font-size: 70%; 
      color: grey; 
     } 

     button.iconmore{ 
      font-size: 80%; 
      color: grey; 
     } 

     ion-col.rightcol{ 
      direction: rtl; 
     } 

     p.content{ 
      font-size: 90%; 
      color: grey; 
     } 
    } 

    .action-sheets-groups-page { 


     .icon-edition { 
      color: grey; 
     } 
     .icon-erase { 
      color: grey; 
     } 
     .action-sheet-cancel ion-icon, 
     .action-sheet-destructive { 
      color: grey; 
     } 
    } 

} 

事前のおかげで!私はドキュメンテーションに従おうとしましたが、私はそれを行う方法ができませんでした。

+0

に置き換える必要があります 他の色で 'grey'ですか? –

+0

'variables.scss'ファイルで定義されているすべての色を試しましたが動作しません – Giannkas

答えて

0

app.scssにスタイルを追加してみ

.action-sheet-has-icons .icon { 
color:/*whatever you want*/ 
} 
+0

ありがとうございますが、動作しません。私は入れた '.action-sheet-has-icons .icon { 色:rgba(29,29,29,0.47); } ' これはionic.cssには存在しませんでしたが、効果がありません。 – Giannkas

+0

ああ申し訳ありません。この記事を読もうとすると、間違いなくhttps://www.tutorialsplane.com/ionic-2-action-sheet/に役立ちます。各ボタンでcssClassを追加するだけです。 – DevSab

+0

@Giannkas何も動作しない場合は、このクラスを追加してみてください.action-sheet-button .action-sheet-icon {color:rgba(29,29,29,0.47)!important; } – DevSab

0
.ion-logo-whatsapp:before { 
    color: green; 
} 
.ion-md-share:before { 
    color: color($colors,favorite); 
} 
.ion-md-close:before { 
    color: red; 
} 

image

1

ionic.cssでこのクラスを更新してみてください。

app.scss:

.ion-logo-whatsapp:before { 
    color: green; 
} 
0

あなたのscssファイルでは、あなたはmuあなたのアクションシートがページにないため、ページ・グループのうち番目の移動「.action-シート・グループ・ページ」のクラスは、{}あなたは代わりに

groups.scss

page-groups { 
    ion-content{ 
     .settitle{ 
      font-size: 70%; 
      color: grey; 
     } 
     button.iconmore{ 
      font-size: 80%; 
      color: grey; 
     } 
     ion-col.rightcol{ 
      direction: rtl; 
     } 
     p.content{ 
      font-size: 90%; 
      color: grey; 
     } 
    } 

} 

.action-sheets-groups-page { 
    .icon-edition { 
     color: grey; 
    } 
    .icon-erase { 
     color: grey; 
    } 
    .action-sheet-cancel ion-icon, 
    .action-sheet-destructive { 
     color: grey; 
    } 
} 
関連する問題