Skip to content
pubscout

dynamic_color

2.1.0, released 3 months ago by material.io

Create Material color schemes based on a platform's implementation of dynamic color.

WASM-readyUses material_ui
$ flutter pub add dynamic_color
Source repository

What it does

It provides a widget called DynamicColorBuilder that supplies light and dark ColorSchemes based on the host platform's dynamic colors. It also includes extensions for color and color scheme harmonization.

AI-written summary of version 2.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want your Flutter app to respect user wallpaper colors on Android S+
  • You want to utilize system accent colors on desktop platforms like Windows, macOS, and Linux

Skip it when

  • You require a strict custom brand color palette that must not be influenced by platform settings

Strengths

  • Supports multiple platforms including Android, Windows, macOS, and Linux
  • Provides built-in color harmonization to keep custom colors cohesive with dynamic colors
  • Offers a dedicated DynamicColorBuilder widget for ease of use

Weaknesses

  • Dynamic color availability is dependent on OS version and platform features

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
2

Add the dependency to pubspec.yaml and use DynamicColorBuilder in your app.

DynamicColorBuilder(
  builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
    return MaterialApp(
      theme: ThemeData(colorScheme: lightDynamic),
      darkTheme: ThemeData(colorScheme: darkDynamic),
    );
  },
)

Alternatives

Packages that do the same job and could replace dynamic_color.

Works with

Packages commonly used together with dynamic_color: ones it builds on, ones built on it, and its own family.