1- # Notes on ng-material 's theme implementation
1+ # Notes on AngularJS Material 's theme implementation
22
33#### TL;DR
4- Themes are configured by users with ` $mdThemingProvider ` . The CSS is then generated at run-time by
5- the ` $mdTheming ` service and tacked into the document head.
4+ You configure themes with ` $mdThemingProvider ` . The CSS is then generated at run-time by
5+ the ` $mdTheming ` service and appended to the document's ` < head> ` .
66
7- ## Actual explanation
7+ ## Explanation
88
99### At build time
10- * All of the styles associated with ** color** are defined in a separate scss file of the form
10+ * All the styles associated with ** color** are defined in a separate SCSS file of the form
1111` xxx-theme.scss ` .
12- * Instead of using hard-coded color or a SCSS variable, the colors are defined with a mini-DSL
13- (described deblow ).
14- * The build process takes all of those ` -theme.scss ` files and globs them up into one enourmous
12+ * Instead of using a hard-coded color or a SCSS variable, you define the colors with a mini-DSL
13+ (described below ).
14+ * The build process takes all of those ` -theme.scss ` files and globs them up into one enormous
1515string.
16- * The build process wraps that string with code to set it an angular module constant:
17- ``` angular.module('material.core').constant('$MD_THEME_CSS', 'HUGE_THEME_STRING'); ```
18- * That code gets dumped at the end of ` angular-material.js `
16+ * The build process wraps that string with code to set it as an AngularJS module constant:
17+ ```
18+ angular.module('material.core').constant('$MD_THEME_CSS', 'HUGE_THEME_STRING');
19+ ```
20+ * That code gets dumped at the end of ` angular-material.js ` .
1921
2022### At run time
2123* The user defines some themes with ` $mdThemingProvider ` during the module config phase.
2224* At module run time, the theming service takes ` $MD_THEME_CSS ` and, for each theme, evaluates the
2325mini-DSL, applies the colors for the theme, and appends the resulting CSS into the document head.
2426
25-
2627### The mini-DSL
27- * Each color is written in the form ` '{{palette-hue-contrast-opacity}}' ` , where ` hue ` , ` contrast ` ,
28+ * You write each color in the form ` '{{palette-hue-contrast-opacity}}' ` , where ` hue ` , ` contrast ` ,
2829and opacity are optional.
29- * For example, ` '{{primary-500}}' `
30- * Palettes are ` primary ` , ` accent ` , ` warn ` , ` background `
30+ * For example, ` '{{primary-500}}' ` .
31+ * Palettes are ` primary ` , ` accent ` , ` warn ` , ` background ` .
3132* The hues for each type use the Material Design hues. When not specified, each palette defaults
32- ` hue ` to ` 500 ` with the exception of ` background `
33+ ` hue ` to ` 500 ` except for ` background ` .
3334* The ` opacity ` value can be a decimal between 0 and 1 or one of the following values based on the
3435hue's contrast type (dark, light, or strongLight):
3536 * ` icon ` : icon (0.54 / 0.87 / 1.0)
@@ -41,4 +42,4 @@ hue's contrast type (dark, light, or strongLight):
4142For example, ` accent-contrast ` will be a contrast color for the accent color, for use as a text
4243color on an accent-colored background. Adding an ` opacity ` value as in ` accent-contrast-icon ` will
4344apply the Material Design icon opacity. Using a decimal opacity value as in ` accent-contrast-0.25 `
44- will apply the contrast color for the accent color at 25% opacity.
45+ will apply the contrast color for the accent color at 25% opacity.
0 commit comments