src/components/colors/colors.js
function extractPalette(parts, theme) {
      // If the next section is one of the palettes we assume it's a two word palette
      // Two word palette can be also written in camelCase, forming camelCase to dash-case

      var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1;
      var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();

      if (isTwoWord)  palette = parts[0] + '-' + parts.splice(1, 1);

      if (colorPalettes.indexOf(palette) === -1) {
        // If the palette is not in the palette list it's one of primary/accent/warn/background
        var scheme = $mdTheming.THEMES[theme].colors[palette];
        if (!scheme) {
          throw new Error($mdUtil.supplant(
            'mdColors: couldn\'t find \'{palette}\' in the palettes.',
            {palette: palette}));
        }
        palette = scheme.name;
      }

      return palette;
    }
function extractPalette(parts, theme) {
      // If the next section is one of the palettes we assume it's a two word palette
      // Two word palette can be also written in camelCase, forming camelCase to dash-case

      var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1;
      var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();

      if (isTwoWord)  palette = parts[0] + '-' + parts.splice(1, 1);

      if (colorPalettes.indexOf(palette) === -1) {
        // If the palette is not in the palette list it's one of primary/accent/warn/background
        var scheme = $mdTheming.THEMES[theme].colors[palette];
        if (!scheme) {
          throw new Error($mdUtil.supplant(
            'mdColors: couldn\'t find \'{palette}\' in the palettes.',
            {palette: palette}));
        }
        palette = scheme.name;
      }

      return palette;
    }
function extractPalette ( parts , theme ) { // If the next section is one of the palettes we assume it's a two word palette // Two word palette can be also written in camelCase, forming camelCase to dash-case var isTwoWord = parts . length > 1 && colorPalettes . indexOf ( parts [ 1 ] ) !== - 1 ; var palette = parts [ 0 ] . replace ( / ([a-z])([A-Z]) / g , '$1-$2' ) . toLowerCase ( ) ; if ( isTwoWord ) palette = parts [ 0 ] + '-' + parts . splice ( 1 , 1 ) ; if ( colorPalettes . indexOf ( palette ) === - 1 ) { // If the palette is not in the palette list it's one of primary/accent/warn/background var scheme = $mdTheming . THEMES [ theme ] . colors [ palette ] ; if ( ! scheme ) { throw new Error ( $mdUtil . supplant ( 'mdColors: couldn\'t find \'{palette}\' in the palettes.' , { palette : palette } ) ) ; } palette = scheme . name ; } return palette ; }
Calculate the theme palette name
@param {Array} parts
@param {string} theme name
@return {string}
Calculate the theme palette name