最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Change material angular tab text color - Stack Overflow

programmeradmin0浏览0评论

I cant figure out how the tabs text color is set for the material design extension of angular. There is codepen examples. I can therefore inspect the element and see it is set by some custom style that some how gets injected into the page. How that is configured though escapes me.

My tabs are currently the default color. I have tried modifying $mdThemingProvider but that does not change the text color.

See:

They do exactly what I want in the first example where the tab text changes on selection.

EDIT: Obviously I can set the CSS however I want to use the templated colors already configured.

I cant figure out how the tabs text color is set for the material design extension of angular. There is codepen examples. I can therefore inspect the element and see it is set by some custom style that some how gets injected into the page. How that is configured though escapes me.

My tabs are currently the default color. I have tried modifying $mdThemingProvider but that does not change the text color.

See: https://material.angularjs/latest/demo/tabs

They do exactly what I want in the first example where the tab text changes on selection.

EDIT: Obviously I can set the CSS however I want to use the templated colors already configured.

Share Improve this question edited Nov 23, 2015 at 4:23 Murdock asked Nov 20, 2015 at 21:42 MurdockMurdock 4,6723 gold badges39 silver badges69 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

It is preferable to configure the default theme via $mdThemingProvider. But, you can override Angular Material's default CSS classes to achieve your desired result.

Tab's background color

md-tabs > md-tabs-wrapper {
  background-color: #f00 !important;
}

Tab's text color

md-tabs > md-tabs-wrapper > md-tabs-canvas > md-pagination-wrapper > md-tab-item:not([disabled]) {
  color: #fff !important;
}

Active tab's text color

md-tabs > md-tabs-wrapper > md-tabs-canvas > md-pagination-wrapper > md-tab-item:not([disabled]).md-active, md-tabs > md-tabs-wrapper > md-tabs-canvas > md-pagination-wrapper > md-tab-item:not([disabled]).md-active md-icon, md-tabs.md-accent > md-tabs-wrapper > md-tabs-canvas > md-pagination-wrapper > md-tab-item:not([disabled]).md-active md-icon, md-tabs.md-default-theme.md-accent > md-tabs-wrapper > md-tabs-canvas > md-pagination-wrapper > md-tab-item:not([disabled]).md-focused, md-tabs.md-default-theme.md-accent > md-tabs-wrapper > md-tabs-canvas > md-pagination-wrapper > md-tab-item:not([disabled]).md-focused md-icon {
  color: #222 !important;
}

Disabled tab's text color

md-tabs .md-tab[disabled], md-tabs .md-tab[disabled] md-icon {
  color: #000 !important;
}

To configure via $mdThemingProvider, please refer Angular Material/$mdThemingProvider.

Hope it helps!

发布评论

评论列表(0)

  1. 暂无评论