angularjs - How do i change the angular material md-primary button text color? -


basically cant life of me figure out how set text color of buttons using angular material , else using md-primary background color.

the code using create theme

var customprimary = {         '50': '#7de3cf',         '100': '#69dec8',         '200': '#54dac0',         '300': '#3fd5b8',         '400': '#2dceaf',         '500': '#28b99d',         '600': '#23a48b',         '700': '#1f8f79',         '800': '#1a7a68',         '900': '#166556',         'a100': '#92e8d7',         'a200': '#a7ecdf',         'a400': '#bcf1e7',         'a700': '#115044'     };     $mdthemingprovider         .definepalette('customprimary',         customprimary);     $mdthemingprovider.theme('buttons')         .primarypalette('customaccent'); 

however no matter try can text colour #fff unless use css , !important i'd avoid, means overriding several selectors.

from docs:

angular.module('myapp', ['ngmaterial']) .config(function($mdthemingprovider) {   $mdthemingprovider.definepalette('amazingpalettename', {     '50': 'ffebee',     ...     'a700': 'd50000',     'contrastdefaultcolor': 'light',    // whether, default, text (contrast)                                         // on palette should dark or light     'contrastdarkcolors': ['50', '100', //hues contrast should 'dark' default      '200', '300', '400', 'a100'],     'contrastlightcolors': undefined    // specify if default 'dark'   });   $mdthemingprovider.theme('default')     .primarypalette('amazingpalettename') }); 

the important thing here contrastdarkcolors/contrastlightcolors. "contrast" color text (or icon) color shows on buttons.

i'm guessing you'll want like

'contrastdefaultcolor': 'light', 'contrastdarkcolors': ['50', '100', '200', '300', 'a100', 'a400'] 

edit: if reason wanted color on button, creating class has !important fine, e.g.

.md-button.cyan-text {     color: cyan !important; } 

and

<md-button class="md-primary md-raised cyan-text">hello world</md-button> 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -