-
Notifications
You must be signed in to change notification settings - Fork 33
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
Make the theme builder open source #350
Comments
This should get some more heat. |
It's already open source, actually. Unless I'm misunderstanding your question. The actual generator algorithm is available at material-foundation/material-color-utilities. |
You can get a basic theme using that package, and yes that is used, but the theme builder does do a lot of logic (it seems) that is different then the basic usage of the package. I myself have been fiddling to reproduce the exact theme for a year without success |
I've encountered a similar problem. To be perfectly honest, I decided to give up on reverse engineering the exact tone values the theme generator pulls, because you're right; there are inconsistencies. For example, the Figma theme builder forbids users from truly setting chroma to 0. If you attempt, it'll reset to ~2 after you close out. And m3 apps produced by Google directly always seem a bit more vibrant than those created from the public tools. I suspect the actual logic of the theme generator relies on a few overrides and niche rule exceptions that aren't publicized or baked into the publicly-accessible theme builders. Anyway, you've mentioned "basic usage." Are you referring to calling the (All I know is JS/TS btw so apologies if this isn't helpful for the platform you're building with) 1. I start with an object containing my key colors.I like to do it with my custom colors already baked in. Here's an example of doing it with state in React, but it can be a normal const variable too.
2. Then, I use this function to generate tones from 1-99 for every key color and save them as camelCased key:value pairs.
3. How this solved the problem for me:You'll notice in my neutrals, especially, that the values for surfaces do not line up 1:1 with the swatches the theme builder says it uses. That's where you can make tweaks fast, by modifying the tones. Since you have multiple vanity themes, as long as each one's in its own repo, you can fine-tune it on a case-by-case basis. In the example below, I have my dark mode surfaceContainers significantly brighter than the defaults. Does this help at all? |
What the title said. Here's my situation.
We have 200+ clients, all with their own vanity themes. The themes are currently defined in some .scss files, like so:
Where
theme-roller
is obviously a mixin that does the actual theme generation with @angular/material mixins.Well, we'd like to use these .scss files to programmatically generate a material 3 theme for each customer. And, amazingly, as far as I've been able to find, there's currently no way to do this programmatically with the crucial (for our customers) "Exact color match" option. The only tool I know of for generating themes programmatically (the
@angular/material
"m3-theme" schematic) does not offer said option. And even more amazingly, there's no source code that I can find on how this tool implements that option, so I can't even modify the m3-theme schematic to include it myself.So, yeah, publishing some source code would be really helpful for those of us who would like to know how this tool is doing what it's doing.
The text was updated successfully, but these errors were encountered: