Skip to content
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

feat(theme-generator): Add possibility to force custom color @angular/material:theme-color #30167

Open
zygarios opened this issue Dec 11, 2024 · 2 comments
Labels
area: ng-generate Schematics that generate code in user projects feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions

Comments

@zygarios
Copy link

Feature Description

My problem is that I still can't understand how @angular/material:theme-color works. In the terminal, I need to provide colors for primary, secondary, and tertiary. For each one, I specify a single color, like #ff9500, because that's what I want.

What HEX color should be used to generate the M3 theme? It will represent your primary color palette. (ex. #ffffff) **#005dba** What HEX color should be used represent the secondary color palette? (Leave blank to use generated colors from Material) **#005dba** What HEX color should be used represent the tertiary color palette? (Leave blank to use generated colors from Material) **#005dba**

However, when generating the theme, I see that it creates color palettes, but when I try to get just my color, I use --mat-sys-primary. Unfortunately, it appears significantly darker (#8c5000), and I don't know which variable the color is actually hidden under. I have the impression that due to the low contrast, it is being artificially darkened. However, I selected the option not to generate mixins with high contrast. I would like to be able to use exactly that color without worrying about contrast. Currently, I am forced to manually change all the system token colors because the generated palette still interferes too much with what I want to achieve, taking away the flexibility I need in this case.

Use Case

It would be great to be able to specify in the terminal that I want exactly the colors I mention, without any interference.

@zygarios zygarios added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Dec 11, 2024
@jimivdw
Copy link

jimivdw commented Dec 13, 2024

Very big +1. The fact that you cannot provide exact colors to an M3 theme is a deal breaker for me. Not being able to use my company's brand colors just because they aren't "up to Material's standards" just feels wrong.

I know I can manually override every color variable, and I will do so when support for M2 gets dropped eventually, but this is just very annoying and I really hope there will be an easier way to use exact colors for a theme.

@amysorto
Copy link
Contributor

@zygarios For each color specified, those colors are used directly to create color palettes of tones that match that color's hue and chroma. If you only specify a single color or a subset, the other colors get created in relation to each other. So there shouldn't be much adjusting happening if you specify everything and aren't requesting high contrast.

Although, Material defines --mat-sys-primary as tone 40 in your primary palette. Typically the color used to create the color palette usually closest to tone 50 in the color palette, which is why it is slightly off to what you are expecting.

Although I do see what you are saying, it would be ideal if you can specify maybe the primary color and then the color palette gets extracted from that to get more color accuracy and be more intuitive. I'll leave this issue open so this can be looked into.

In the meantime, overriding colors is your best option for complete customization: https://material.angular.io/guide/theming#system-tokens

@amysorto amysorto added P4 A relatively minor issue that is not relevant to core functions area: ng-generate Schematics that generate code in user projects and removed needs triage This issue needs to be triaged by the team labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ng-generate Schematics that generate code in user projects feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

3 participants