Skip to content

Commit 0359c5e

Browse files
committed
docs(): add docs for new devs to get started.
1 parent 813ae4d commit 0359c5e

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

DEV_ENVIRONMENT.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Developer guide: getting your environment set up
2+
3+
1. Make sure you have `node` installed with a version at _least_ 4.2.3.
4+
2. Run `npm install -g angular-cli` to install the Angular CLI.
5+
3. Fork the `angular/material2` repo.
6+
4. Clone your fork.
7+
Recommendation: name your git remotes `upstream` for `angular/material2`
8+
and `<your-username>` for your fork. Also see the [team git shortcuts](https://github.com/angular/material2/wiki/Team-git----bash-shortcuts).
9+
5. From the root of the project, run `npm install`
10+
11+
12+
To build the project, run `ng build`.
13+
To watch for changes and automatically rebuild, run `ng build --watch`
14+
15+
To bring up a local server, run `ng serve`. This will automatically watch for changes and rebuild.
16+
After the changes rebuild, the browser currently needs to be manually refreshed.
17+
18+
To run unit tests, run `ng test`.
19+
20+
Running e2e tests: <not yet implemented>
21+
Running benchmarks: <not yet implemented>
22+
Running screenshot diff tests: <not yet implemented>

docs/scss-theming.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Theming components with SCSS
2+
ng-material comes packaged with the [color palettes in the Material Design spec](https://www.google.com/design/spec/style/color.html#color-color-palette).
3+
The palettes are in `_palette.scss`.
4+
Each will be a SCSS map:
5+
$md-indigo: (
6+
50: #e8eaf6,
7+
100: #c5cae9,
8+
200: #9fa8da,
9+
...
10+
);
11+
12+
A theme, then, is a _set_ of palettes defined in terms of these (or custom) color palettes:
13+
14+
```scss
15+
/** A typical theme definition file. */
16+
17+
$md-is-dark-theme: false;
18+
19+
$md-primary: md-palette($md-indigo, 500, 100, 700, $md-contrast-palettes);
20+
$md-accent: md-palette($md-red, A200, A100, A400, $md-contrast-palettes);
21+
$md-warn: md-palette($md-red, 500, 300, 800, $md-contrast-palettes);
22+
$md-foreground: if($md-is-dark-theme, $md-dark-theme-foreground, $md-light-theme-foreground);
23+
$md-background: if($md-is-dark-theme, $md-dark-theme-background, $md-light-theme-background);
24+
```
25+
26+
The md-palette function creates a theme palette that contains all the colors of the original color
27+
palette plus contrast colors and semantic shortcuts for the specified hues.
28+
29+
30+
Once that is defined, an individual component is styled in terms of the theme palettes:
31+
my-comp {
32+
color: md-color($md-foreground, text);
33+
background-color: md-color($md-background, lighter); // Use one of the configured hue by semantic name.
34+
&.md-primary {
35+
color: md-color($md-primary, 300-contrast);
36+
background-color: md-color($md-primary, 300, 0.7); // Use a specific hue and opacity
37+
}
38+
}
39+
40+
The md-color function lets the user reference a specific color from the theme palette,
41+
either by a semantic name (e.g., "primary, lighter"), or directly by numbered hue
42+
(e.g., "accent, A700"). For each hue, a "-contrast" version is also present in the theme palette.
43+
The function also allows the user to specify an opacity.

src/core/style/_palette.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ $md-dark-theme-foreground: (
374374
);
375375

376376

377+
378+
// TODO(jelbourn): Do we actually need these any more? Updates to the spec about how foreground
379+
// colors are used may have made this obsolete.
380+
377381
// Contrast colors. These are hard-coded because it is too difficult (probably impossible) to
378382
// calculate them. These contrast colors are pulled from the public Material Design spec swatches.
379383
// While the contrast colors in the spec are not perscriptive, we will use them for convenience.

0 commit comments

Comments
 (0)