2

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.

enter image description here

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

enter image description here

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.

1 Answer 1

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!

Sign up to request clarification or add additional context in comments.

3 Comments

Thanx. I have tried using the mdThemingProvider however I could not change those specific colors
@Murdock Have you tried above CSS? Is it working in your case?
Yes it works, but would really like to hook into the templates defined in the material templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.