dynamic_color 1.3.0 copy "dynamic_color: ^1.3.0" to clipboard
dynamic_color: ^1.3.0 copied to clipboard

A Flutter package to create Material color schemes based on a platform's implementation of dynamic color.

dynamic_color #

pub package

A Flutter package to create Material color schemes based on a platform's implementation of dynamic color. Currently supported platforms are:

This package also supports color and color scheme harmonization. Learn more about custom colors and harmonization on the Material 3 site.

Features #

Builder widget #

For convenience, this package includes DynamicColorBuilder, a stateful widget that provides the device's dynamic colors in a light and dark ColorScheme.

Plugin #

Under the hood, DynamicColorBuilder uses a plugin to talk to the OS.

Color and color scheme harmonization #

How do we ensure any particular color (i.e. semantic/custom color) looks good next to a user's dynamically-generated color?

This package provides two extension methods, Color.harmonizeWith() and ColorScheme.harmonized() to accomplish this.

Color.harmonizeWith() shift the hue of the color towards the passed in color, typically colorScheme.primary. This leaves the color recognizable while harmonizing it.

ColorScheme.harmonized() does the same thing, for ColorScheme's built-in semantic colors. See harmonization.dart for more.

Getting started #

flutter pub add dynamic_color

import 'package:dynamic_color/dynamic_color.dart';

Usage #

See this complete example for obtaining dynamic colors, creating harmonized color schemes, and harmonizing custom colors.

All examples are hosted on GitHub and can be run with:

cd example
flutter run

Development #

The hosted examples can be updated with:

cd example
flutter build web
482
likes
0
pub points
98%
popularity

Publisher

verified publishermaterial.io

A Flutter package to create Material color schemes based on a platform's implementation of dynamic color.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_test, material_color_utilities

More

Packages that depend on dynamic_color