-
I wanted to share my experience using this package and also the standard Flutter practises to generate impressive themes based on a primary color. In my specific use case, it's crucial to preserve the Brand Color and minimize any distortion while generating the palette. I've already experimented with the colorSchemeSeed provided by official Flutter and explored the functions offered by the FlexThemeData package. Regrettably, I haven't achieved the desired results yet. The following web demo closely matches the requirements for ensuring consistent corporate colors, whether it's for me or for someone else with similar needs. https://mcg.mbitson.com/#!?mcgpalette0=%233f51b5 A way to achieve this goal also with this package would be great |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hi @razfazz, thanks for your question 😃 The palette you are linking too is using the older Material 2 Color System and Material Color Palette that was in use in Material 2. Google never published the exact algorithm for creating those color palettes. Some libraries exist(ed) in JS that were reverse engineered from the web site. But I never found any Dart ports of it. There is a variant of it included in the color picker in the app, that makes a "fake" Material Color palette swatch, but it is not an exact match, far from it. That color system is also effectively obsolete. You should instead migrate to using the new color system based on the new Google Color Space HCT (Hue Chroma Tone) that uses tonal palettes instead. The tonal palettes are different from past Material Color palettes. Read more about it here: https://m3.material.io/styles/color/the-color-system/key-colors-tones If you really want to use colors from those older Material 2 Color palettes, you can use the customizable color scheme in the Playground and copy/paste the shades you want to use from the palettes you have, to primary, primaryContainer, secondary, secondaryContainer, tertiary and tertiaryContainer colors. Select e.g. Jolly Seed method, and use all tree colors as seed colors and also lock down all the colors you added custom value for, to still keep them exactly as given in the seeded result, but calculating other colors that are not as critical. Here is a tweet story that shows some Playground techniques that amy be helpful: https://twitter.com/RydMike/status/1658657667622248449?s=20 In code you can alternatively make a custom ColorScheme using colors, from the palette you showed, and other sources as desired, and then passing in an entire premade ColorScheme to FlexColorScheme/FlexThemeData. With the API you can do this, but not in the Playground. |
Beta Was this translation helpful? Give feedback.
-
This is good question though and we can continue it in discussions, if you need further info and some examples on how to do what I described above, using a few example colors from the Material Palette you linked. As for ever getting the algo used to produce exactly those older Material palettes programmatically in Dart, that ship has sailed. I did spend quite some time looking for it before, and consider porting one of the JS ports over. I think I even found a Java or Kotlin reversed engineered version of it at some point, I probably have the links stored somewhere still. But since Google is moving full tilt to the HCT color system and since that algo is public, I'm not going to put any more effort into the older palettes. Besides, the HCT tonal palettes are fabulous, better than the older ones. |
Beta Was this translation helpful? Give feedback.
-
I have the same problem and would love to have an option to generate a "as close as possible branding color palette" |
Beta Was this translation helpful? Give feedback.
-
wow thank you for that detailed explanation. I will try that asap |
Beta Was this translation helpful? Give feedback.
Hi @razfazz, thanks for your question 😃
The palette you are linking too is using the older Material 2 Color System and Material Color Palette that was in use in Material 2.
Google never published the exact algorithm for creating those color palettes. Some libraries exist(ed) in JS that were reverse engineered from the web site. But I never found any Dart ports of it. There is a variant of it included in the color picker in the app, that makes a "fake" Material Color palette swatch, but it is not an exact match, far from it.
That color system is also effectively obsolete. You should instead migrate to using the new color system based on the new Google Color Space HCT (Hue Chroma Tone) that…