color_tones
A Flutter package that generates lighter and darker variations of a base color using simple tone values, allowing easy creation of dynamic and consistent color palettes.
Features
- Generate lighter or darker tones from any base color.
- Simple API for varying color tones from
50(lightest) to900(darkest), similar to Material Design. - Extension method for intuitive and quick access.
Getting Started
To use color_tones, add it as a dependency in your Flutter project's pubspec.yaml:
dependencies:
color_tones: ^1.0.0
Then run:
flutter pub get
Usage
Here's how you can use the package in your Dart code:
import 'package:flutter/material.dart';
import 'package:color_tones/color_tones.dart';
void main() {
Color baseColor = Colors.blue;
Color lighterColor = baseColor.tone(200); // lighter shade
Color darkerColor = baseColor.tone(700); // darker shade
print('Lighter Color: \$lighterColor');
print('Darker Color: \$darkerColor');
}
Explanation of Tone Values
The package follows a standard scale:
-
toneless than500: lighter variation- Example:
50(very light),300(moderately light)
- Example:
-
tonegreater than500: darker variation- Example:
600(slightly dark),900(very dark)
- Example:
-
toneequal to500: returns the original base color
Additional information
Feel free to open issues or contribute via pull requests on the repository.
Libraries
- color_tones
- Support for doing something awesome.