Angular Material动态定义自定义调色板

时间:2016-12-06 22:12:42

标签: javascript angularjs angular-material

我已经关注了代码:

var theme = themeProvider.theme('default')
  .primaryPalette('red')
  .accentPalette('pink');

$mdTheming.generateTheme('default');

themeProvider.setDefaultTheme('default');

$mdTheming.THEMES['default'] = theme;

现在我想像这样定义自定义选项板:

themeProvider.definePalette('amazingPaletteName', {
    '50': 'ffebee',
    '100': 'ffcdd2',
    '200': 'ef9a9a',
    '300': 'e57373',
    '400': 'ef5350',
    '500': 'f44336',
    '600': 'e53935',
    '700': 'd32f2f',
    '800': 'c62828',
    '900': 'b71c1c',
    'A100': 'ff8a80',
    'A200': 'ff5252',
    'A400': 'ff1744',
    'A700': 'd50000',
    'contrastDefaultColor': 'light',    // whether, by default, text (contrast)
                                        // on this palette should be dark or light

    'contrastDarkColors': ['50', '100', //hues which contrast should be 'dark' by default
     '200', '300', '400', 'A100'],
    'contrastLightColors': undefined    // could also specify this if default was 'dark'
  });

但调色板不被接受,我当时没有调色板。

有没有办法用角度材料做到这一点?

0 个答案:

没有答案