Skip to content

Migrate to new APIs away from CorePalette/Scheme - #699

Draft
helomri wants to merge 6 commits into
material-foundation:mainfrom
helomri:feat/new-apis
Draft

Migrate to new APIs away from CorePalette/Scheme#699
helomri wants to merge 6 commits into
material-foundation:mainfrom
helomri:feat/new-apis

Conversation

@helomri

@helomri helomri commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

This enables developers to generate color schemes with the contrast they want and request specific variants for a dynamic scheme (which unfortunately cannot fully be correct since Android does not expose the necessary information to do that). The error palette is now also fetched from the OS. CorePalettes does not let us store this palette yet, so currently we only work with List<TonalPalette>.

Old APIs are deprecated but still working. This lets time for people to adopt the new ones that can eventually be removed.

I have added new pages in the example app to test/demo the new behavior.

Tests

I have added the option to mock the tonal palettes and have also added samples for testing. I have updated an expected value (twice) as CorePalette used an unknown palette generation algorithm that is not reproducible using official variants.

I did not add tests to check for conversion to a color scheme from a dynamic scheme since the existing testing for conversion only covered retro-compatibility, which we do not have to do anymore.

I have added some dependency overrides to improve the dev environment.

Issues

Fixes #363

Checklist

@helomri

helomri commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@guidezpl Do you think the error palette could be added to CorePalettes upstream inside MCU? If so, I will update this draft to use it instead of List<TonalPalette>s (which aren't that intuitive).

# Conflicts:
#	packages/dynamic_color/example/pubspec.lock
#	packages/dynamic_color/pubspec.lock
#	packages/dynamic_color_testing/analysis_options.yaml
@kalidamare38-afk kalidamare38-afk mentioned this pull request Aug 29, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate deprecated CorePalette / Scheme APIs to CorePalettes + DynamicScheme

1 participant