color_tones 1.0.0 copy "color_tones: ^1.0.0" to clipboard
color_tones: ^1.0.0 copied to clipboard

A Flutter package that generates lighter and darker variations of a base color using tone values, making it easy to create consistent color palettes dynamically.

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) to 900 (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:

  • tone less than 500: lighter variation

    • Example: 50 (very light), 300 (moderately light)
  • tone greater than 500: darker variation

    • Example: 600 (slightly dark), 900 (very dark)
  • tone equal to 500: returns the original base color

Additional information #

Feel free to open issues or contribute via pull requests on the repository.

9
likes
150
points
18
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that generates lighter and darker variations of a base color using tone values, making it easy to create consistent color palettes dynamically.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on color_tones