This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theming): rename palette methods, change default palettes
BREAKING: primaryColor, accentColor, and warnColor are depricated. Use primaryPalette, accentPalette, and warnPalette instead. Additionally the default palettes have been changed to indigo for primary and pink as accent. Configure your default theme using $mdThemingProvider to change. Closes #1252
- Loading branch information
1 parent
ba71a59
commit 0e0846f
Showing
6 changed files
with
39 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,10 +61,10 @@ var DEFAULT_COLOR_TYPE = 'primary'; | |
// A color in a theme will use these hues by default, if not specified by user. | ||
var LIGHT_DEFAULT_HUES = { | ||
'accent': { | ||
'default': 'A700', | ||
'hue-1': 'A200', | ||
'default': 'A200', | ||
'hue-1': 'A100', | ||
'hue-2': 'A400', | ||
'hue-3': 'A100' | ||
'hue-3': 'A700' | ||
} | ||
}; | ||
var DARK_DEFAULT_HUES = { | ||
|
@@ -154,7 +154,7 @@ function ThemingProvider($mdColorPalette) { | |
// Register a theme (which is a collection of color palettes to use with various states | ||
// ie. warn, accent, primary ) | ||
// Optionally inherit from an existing theme | ||
// $mdThemingProvider.theme('custom-theme').primaryColor('red'); | ||
// $mdThemingProvider.theme('custom-theme').primaryPalette('red'); | ||
function registerTheme(name, inheritFrom) { | ||
inheritFrom = inheritFrom || 'default'; | ||
if (THEMES[name]) return THEMES[name]; | ||
|
@@ -219,7 +219,7 @@ function ThemingProvider($mdColorPalette) { | |
|
||
THEME_COLOR_TYPES.forEach(function(colorType) { | ||
var defaultHues = (self.isDark ? DARK_DEFAULT_HUES : LIGHT_DEFAULT_HUES)[colorType]; | ||
self[colorType + 'Color'] = function setColorType(paletteName, hues) { | ||
self[colorType + 'Palette'] = function setPaletteType(paletteName, hues) { | ||
var color = self.colors[colorType] = { | ||
name: paletteName, | ||
hues: angular.extend({}, defaultHues, hues) | ||
|
@@ -248,9 +248,15 @@ function ThemingProvider($mdColorPalette) { | |
); | ||
} | ||
}); | ||
|
||
return self; | ||
}; | ||
|
||
self[colorType + 'Color'] = function() { | ||
var args = Array.prototype.slice.call(arguments); | ||
console.warn('$mdThemingProviderTheme.' + colorType + 'Color() has been depricated. ' + | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ajoslin
Contributor
|
||
'Use $mdThemingProviderTheme.' + colorType + 'Palette() instead.'); | ||
return self[colorType + 'Palette'].apply(self, args); | ||
}; | ||
}); | ||
} | ||
|
||
|
@@ -450,7 +456,7 @@ function generateThemes($injector) { | |
var lightColors = palette.contrastLightColors || []; | ||
var darkColors = palette.contrastDarkColors || []; | ||
|
||
// Sass provides these colors as space-separated lists | ||
// These colors are provided as space-separated lists | ||
if (typeof lightColors === 'string') lightColors = lightColors.split(' '); | ||
if (typeof darkColors === 'string') darkColors = darkColors.split(' '); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use $log.warn