Skip to content

docs(material/theming): rewrite theming guide for @use #22268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2021

Conversation

jelbourn
Copy link
Member

This change completely rewrites the theming guide to be more complete, correct, and concise.

Summary of changes:

  • Explain the concepts of palettes, hues, and themes.
  • Ensure all content is conceptual and not task-based.
  • Use the new Sass @use API introduced in feat(material/core): expose new @use-based Sass API #22173
  • Document usage of the theming system with shadow dom
  • Document the fact that CSS overrides are strongly discouraged
  • Be more explicit about which palettes we provide
  • Consolidate on a single approach to including theme CSS in an app (assuming Angular CLI)

I will send follow-up PRs for the typography, theming-your-components, and customizing-component-styles guides.

@jelbourn jelbourn added docs This issue is related to documentation merge safe target: major This PR is targeted for the next major release labels Mar 17, 2021
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Mar 17, 2021
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few nits.

Copy link
Contributor

@twerske twerske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I added feedback but nothing blocking :)

#### Multiple themes and overlay-based components
| Theme | Light or dark? | Palettes (primary, accent, warn) |
|------------------------|----------------|----------------------------------|
| `deeppurple-amber.css` | Dark | deep-purple, amber, red |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we map this to look like the example of how we explain defining themes?
I think that might remove some of the mystery of these pre-defined themes

$deeppurple-amber: mat.define-dark-theme((
 color: (
   primary: mat.define-palette(mat.$deep-purple-palette, ???),
   accent: mat.define-palette(mat.$amber-palette, ???)
 )
));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a sentence that links to the source so people can reference these implementations as examples.

Copy link
Contributor

@andrewseguin andrewseguin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a huge improvement! Great job on the doc, and for helping to come up with way better Sass function names. define-palette is so much easier to understand than just palette.

One thing to consider - there will be users who just want to get started quickly. It feels like we are missing a clear section that says: "copy/paste this to just get your initial app working". We had something like this linked from our Getting Started guide: https://material.angular.io/guide/theming#using-a-pre-built-theme

Side note: that reminds me, this should also make sure the Getting Started guide links correctly into this doc - right now we've got deep links to #using-a-pre-built-theme and ##defining-a-custom-theme

`@angular/material/prebuilt-themes`
A **palette** is a collection of colors representing a portion of color space. Each value in this
collection is called a **hue**. In Material Design, the hues in a palette are numbered from zero
to 900, lightest to darkest.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0-900 sounds like every integer, would it make sense to say the hues in a palette are numbered [0, 100, 200, ..., 900]?

This may be unnecessary since its obvious from the following code example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded to be more explicit. It's unfortunate that there's no a nice way to say "each 100 value between 100 and 900 and also 50 for some reason". Also added a link.

@jelbourn jelbourn force-pushed the theming-docs-update branch 3 times, most recently from aa579d4 to 9905f7a Compare March 22, 2021 21:10
@jelbourn
Copy link
Member Author

Comments addressed- I updated the getting started guide with the correct header link (the prebuilt one is actually still the same).

As for quickly getting started- I think that this is covered already by the getting started guide which lets you just select a prebuilt theme during ng add

@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Mar 22, 2021
@jelbourn jelbourn removed the request for review from aikithoughts March 22, 2021 21:33
This change completely rewrites the theming guide to be more complete, correct, and concise.

Summary of changes:
* Explain the concepts of palettes, hues, and themes.
* Ensure all content is conceptual and not task-based.
* Use the new Sass `@use` API introduced in angular#22173
* Document usage of the theming system with shadow dom
* Document the fact that CSS overrides are strongly discouraged
* Be more explicit about which palettes we provide
* Consolidate on a single approach to including theme CSS in an app (assuming Angular CLI)

I will send follow-up PRs for the typography, theming-your-components, and customizing-component-styles guides.
@jelbourn jelbourn force-pushed the theming-docs-update branch from 9905f7a to 1b2e3b9 Compare March 23, 2021 16:17
@andrewseguin andrewseguin merged commit ba6efbf into angular:master Mar 23, 2021
jelbourn added a commit to jelbourn/components that referenced this pull request Mar 30, 2021
This change completely rewrites the typography guide to be more
complete, correct, and concise.

Summary of changes:
* Explain the concepts of "typography level" and "typography config".
* Ensure all content is conceptual and not task-based.
* Use new Sass `@use` API introduiced in angular#22173
* Split up level descriptions from CSS classes
* Clarify that the system currently uses the 2014-era typography levels

This is the second PR in a series, following angular#22268. After this will be
PRs for theming-your-components, customizing-component-styles, and new
docs for strong focus indicators.
jelbourn added a commit to jelbourn/components that referenced this pull request Mar 30, 2021
This change completely rewrites the typography guide to be more
complete, correct, and concise.

Summary of changes:
* Explain the concepts of "typography level" and "typography config".
* Ensure all content is conceptual and not task-based.
* Use new Sass `@use` API introduiced in angular#22173
* Split up level descriptions from CSS classes
* Clarify that the system currently uses the 2014-era typography levels

This is the second PR in a series, following angular#22268. After this will be
PRs for theming-your-components, customizing-component-styles, and new
docs for strong focus indicators.
jelbourn added a commit to jelbourn/components that referenced this pull request Mar 31, 2021
This change completely rewrites the typography guide to be more
complete, correct, and concise.

Summary of changes:
* Explain the concepts of "typography level" and "typography config".
* Ensure all content is conceptual and not task-based.
* Use new Sass `@use` API introduiced in angular#22173
* Split up level descriptions from CSS classes
* Clarify that the system currently uses the 2014-era typography levels

This is the second PR in a series, following angular#22268. After this will be
PRs for theming-your-components, customizing-component-styles, and new
docs for strong focus indicators.
jelbourn added a commit to jelbourn/components that referenced this pull request Mar 31, 2021
This change completely rewrites the typography guide to be more
complete, correct, and concise.

Summary of changes:
* Explain the concepts of "typography level" and "typography config".
* Ensure all content is conceptual and not task-based.
* Use new Sass `@use` API introduiced in angular#22173
* Split up level descriptions from CSS classes
* Clarify that the system currently uses the 2014-era typography levels

This is the second PR in a series, following angular#22268. After this will be
PRs for theming-your-components, customizing-component-styles, and new
docs for strong focus indicators.
annieyw pushed a commit that referenced this pull request Apr 1, 2021
This change completely rewrites the typography guide to be more
complete, correct, and concise.

Summary of changes:
* Explain the concepts of "typography level" and "typography config".
* Ensure all content is conceptual and not task-based.
* Use new Sass `@use` API introduiced in #22173
* Split up level descriptions from CSS classes
* Clarify that the system currently uses the 2014-era typography levels

This is the second PR in a series, following #22268. After this will be
PRs for theming-your-components, customizing-component-styles, and new
docs for strong focus indicators.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement docs This issue is related to documentation target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants