首页 文章

如何更改活性离子标签的颜色?

提问于
浏览
0

我正在尝试将活性离子标签的背景颜色从白色更改为绿色 . 我找到了这个帖子,但似乎答案不再适用了:

https://forum.ionicframework.com/t/change-color-of-active-state-in-tab-icons/12547

有人知道怎么做这个吗?

谢谢 .

4 回答

  • 4

    像这样添加样式到 .tab-item-active

    .tab-item-active {
        background:green;
    }
    

    看到这个codepen:http://codepen.io/edisonpappi/pen/aWvmjz

  • 0

    对我来说,为“.activated”类设置CSS规则是有效的 .

    .activated {
       background-color: blue;
    }
    

    此类将立即应用于所选的选项卡项 .

  • 2

    这可以通过以下方式完成:

    Ionic有以下css:

    .tab-item.tab-item-active, .tab-item.active, .tab-item.activated {
        opacity: 1;
    }
    

    你需要覆盖它如下:

    .tab-item.tab-item-active, .tab-item.active, .tab-item.activated {
        color: red;
    }
    
  • 0

    您也可以在 theme/variables.scss 中使用SCSS $tabs-ios-tab-icon-color-active var,例如:

    // App iOS Variables
    // --------------------------------------------------
    // iOS only Sass variables can go here
    
    $tabs-ios-tab-icon-color: #00f;
    $tabs-ios-tab-icon-color-active: #f00;
    
    
    // App Material Design Variables
    // --------------------------------------------------
    // Material Design only Sass variables can go here
    
    $tabs-md-tab-icon-color: #00f;
    $tabs-md-tab-icon-color-active: #f00;
    

    这会给你这样的东西:

    ionic-tabs-md-tab-icon-color-active-example

    更多信息,请查看here .

    希望能有所帮助 .

相关问题