M3 colorscheme provides all properties like, primary
, onPrimary
, secondary
, onSecondary
etc, but they are generally not exactly the same from the colors they are generated from, i.e., the generated colors are different from the seed values.
For Example
TonalPallete of 0064ff
as primary color will be changed to 0054d8
or somewhat similiar.
This is how I am getting a palette from the color
TonalPalette get tonalPalette {
final cam16 = Cam16.fromInt(value);
return TonalPalette.of(cam16.hue, cam16.chroma);
}
This extension creates Palette which can be used to create the colorScheme (primary40 for primary, primary100 for onPrimary, primary90 for primaryContainer etc.)
For Reference :
Real Question :
I need to generate the Seed color from the TonalPallete colors, Kind of backtracking the original/seed color from the generated tonal primary color. Anyway we can do it. Thanks.
Edit : Just to let you know, I dont have a TonalPalette as the object but only its values.
Got to know something from the friend and he stated
So we actually can't have it back :(