Skip to content
pubscout

material_color_generator

1.1.0, released 6 years ago by berkan.io

Generates a MaterialColor palette from a single HEX color.

WASM-ready
$ flutter pub add material_color_generator
Source repository

What it does

The package provides a function that takes a HEX color and creates a MaterialColor with the required swatch values. It enables using any custom color as a primarySwatch in ThemeData.

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

Use it when

  • You need a custom primarySwatch without manually defining all shades
  • You want quick theming based on brand colors

Skip it when

  • You require advanced color manipulation or accessibility checks
  • You need a full design system beyond simple color swatches

Strengths

  • Simple API, single function call
  • Supports null safety
  • Works on all Flutter platforms

Weaknesses

  • Limited to generating basic MaterialColor palettes
  • No customization of shade generation algorithm

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
MaterialApp(
  debugShowCheckedModeBanner: false,
  title: 'Flutter App',
  theme: ThemeData(
    primarySwatch: generateMaterialColor(color: Color(0xFF113861)),
  ),
);

Alternatives

Packages that do the same job and could replace material_color_generator.

Works with

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