Skip to content

refactor: use system terminology in foreground/background palettes #31032

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andrewseguin
Copy link
Contributor

Adds "system" key to the theme config's background and foreground palettes, such as "surface" and "on-surface". E.g. here's bottom sheet's M2 token before/after:

// Before:
@function get-color-tokens($theme) {
  @return (
    container-text-color: inspection.get-theme-color($theme, foreground, text),
    container-background-color: inspection.get-theme-color($theme, background, dialog),
  );
}
// After:
@function get-color-tokens($theme) {
  @return (
    container-text-color: inspection.get-theme-color($theme, foreground, on-surface),
    container-background-color: inspection.get-theme-color($theme, background, surface),
  );
}

Changes the library to use these keys instead of the existing bespoke terms, like "disabled-button" or "hint-text". Instead, m2 token files should exclusively use these system keys which will help eventually make sense which tokens should be finalized.

The existing keys are kept for backwards compatibility, but going forward the new keys should eventually be trimmed down to make more sense, especially with opacities. Already it's apparent that components are not well aligned, like the button toggle making up a good number of tokens for itself rather than relying on the "system"

@andrewseguin andrewseguin requested a review from a team as a code owner May 5, 2025 15:51
@andrewseguin andrewseguin requested review from crisbeto, ok7sai, mmalerba and wagnermaciel and removed request for a team May 5, 2025 15:51
base-54: rgba($base, 0.54),
base-60: rgba($base, 0.6),
base-87: rgba($base, 0.87),
base-08-04: rgba($base, if($is-dark, 0.08, 0.04)),
Copy link
Contributor

Choose a reason for hiding this comment

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

are these (e.g. base-08-04 )things we intend to expose long term or just temporarily?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just temporary to help me figure things out. I actually dont want users using this at all. Eventually we'll have some final exposed tokens like we have in GM3. In fact hopefully just something that fits right into https://material.angular.dev/guide/system-variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants