Skip to content

fix(material/schematics): estimate missing hues in M3 schematic #29231

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
Jun 11, 2024

Conversation

crisbeto
Copy link
Member

We use @material/material-color-utilities to generate the palettes in the M3 ng generate schematic, but it appears that the utilities don't generate all the neutral hues for some colors which leads to transparent dropdowns (see #29157). We handle this in our built in palettes by estimating the missing hues based on the hues around them.

These changes port the estimation logic to the schematic to ensure that we always generate full themes.

Fixes #29157.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
We use `@material/material-color-utilities` to generate the palettes in the M3 `ng generate` schematic, but it appears that the utilities don't generate all the neutral hues for some colors which leads to transparent dropdowns (see angular#29157). We handle this in our built in palettes by estimating the missing hues based on the hues around them.

These changes port the estimation logic to the schematic to ensure that we always generate full themes.

Fixes angular#29157.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jun 11, 2024
@crisbeto crisbeto requested a review from a team as a code owner June 11, 2024 10:24
@crisbeto crisbeto requested review from amysorto, mmalerba and andrewseguin and removed request for a team June 11, 2024 10:24

let newNeutral: Map<number, string> | null = null;

for (const [hue, {prev, next}] of NEUTRAL_HUES) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The logic here can be simplified, but I wanted to avoid mutating the original map.

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Jun 11, 2024
@crisbeto crisbeto merged commit 3da4323 into angular:main Jun 11, 2024
22 of 25 checks passed
crisbeto added a commit that referenced this pull request Jun 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
We use `@material/material-color-utilities` to generate the palettes in the M3 `ng generate` schematic, but it appears that the utilities don't generate all the neutral hues for some colors which leads to transparent dropdowns (see #29157). We handle this in our built in palettes by estimating the missing hues based on the hues around them.

These changes port the estimation logic to the schematic to ensure that we always generate full themes.

Fixes #29157.

(cherry picked from commit 3da4323)
@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 Jul 12, 2024
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 target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(matSelect): mat-select background color is transparent when using m3 theme
2 participants