function registerTheme(name, inheritFrom) {
    if (THEMES[name]) return THEMES[name];

    inheritFrom = inheritFrom || 'default';

    var parentTheme = typeof inheritFrom === 'string' ? THEMES[inheritFrom] : inheritFrom;
    var theme = new Theme(name);

    if (parentTheme) {
      angular.forEach(parentTheme.colors, function(color, colorType) {
        theme.colors[colorType] = {
          name: color.name,
          // Make sure a COPY of the hues is given to the child color,
          // not the same reference.
          hues: angular.extend({}, color.hues)
        };
      });
    }
    THEMES[name] = theme;

    return theme;
  }
@ngdoc method
@name $mdThemingProvider#theme
@description
Register a theme (which is a collection of color palettes); i.e. `warn`, `accent`,
`background`, and `primary`.<br>
Optionally inherit from an existing theme.
@param {string} name Name of theme being registered
@param {string=} inheritFrom Existing theme name to inherit from