material_color_generator
1.1.0, released 6 years ago by berkan.io
Generates a MaterialColor palette from a single HEX color.
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.
- flex_color_scheme
Builds matched light and dark ThemeData for Flutter with Material design themes and seed colors.
89Compare - material_color_utilities
Algorithms and utilities for the Material Design 3 color system.
86Compare - dynamic_color
Create Material color schemes based on a platform's implementation of dynamic color.
83Compare - flutter_color
Flutter plugin for working with color schemes like hex, hsl, xyz, and cielab.
82Compare
Works with
Packages commonly used together with material_color_generator: ones it builds on, ones built on it, and its own family.