Skip to content

Conversation

andrewseguin
Copy link
Contributor

@andrewseguin andrewseguin commented Jul 29, 2025

Add a new mat.m2-theme($config) mixin that existing M2 clients can call to define system-level CSS variables.

This lets clients drop the need to pass around the theme config to custom components and instead just rely on the same CSS variables defined at https://material.angular.dev/guide/system-variables

// Existing M2 theme file

html {
  @include mat.m2-theme($theme-config);
}
// Output

html {
    --mat-sys-background: #faf9fd;
    --mat-sys-error: #ba1a1a;
    --mat-sys-error-container: #ffdad6;
    --mat-sys-inverse-on-surface: #f2f0f4;
    --mat-sys-inverse-primary: #abc7ff;
    --mat-sys-inverse-surface: #2f3033;
    --mat-sys-on-background: #1a1b1f;
    --mat-sys-on-error: #ffffff;
    --mat-sys-on-error-container: #93000a;
    --mat-sys-on-primary: #ffffff;
    ...
}

@andrewseguin andrewseguin requested review from a team as code owners July 29, 2025 21:51
@andrewseguin andrewseguin requested review from adolgachev and wagnermaciel and removed request for a team July 29, 2025 21:51
@andrewseguin andrewseguin changed the title M2 theme mixin feat(material/core): add an m2-theme API to define system vars Jul 29, 2025
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: material/core labels Jul 29, 2025
@andrewseguin andrewseguin added the target: minor This PR is targeted for the next minor release label Jul 29, 2025
@andrewseguin andrewseguin requested a review from crisbeto July 29, 2025 21:52
@andrewseguin andrewseguin added the action: merge The PR is ready for merge by the caretaker label Jul 30, 2025
@andrewseguin andrewseguin merged commit 20e6e92 into angular:main Jul 30, 2025
22 of 25 checks passed
@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 Aug 30, 2025
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 area: material/core detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants