random_color

Creator: coderz1093

Last updated:

Add to Cart

Description:

random color

Random color generator #

Pub link: https://pub.dartlang.org/packages/random_color
This library will generate random colors that are visually pleasing and can be customized by passing custom hue, saturation and brightness range.
This allows it to generate just specific color with slight differences.
Blue colors:

Red colors:

Green:

Low saturation:

High saturation:

Light colors:

Dark colors:

Usage #
Getting random color:
random color function can be called with parameters colorHue, colorSaturation and colorBrightness
allowing for customization of colors the generator will pass.
import 'package:random_color/random_color.dart';

RandomColor _randomColor = RandomColor();

Color _color = _randomColor.randomColor();
copied to clipboard
Getting color name:
You can get color name from hex string (without # and alpha hex values) or from Color object
Color _color = Color('FF0000'.toStringRadix(16));
MyColor _myColor = getColorNameFromColor(_color);

// Prints: 'Red'
print(_myColor.getName);
copied to clipboard
Get just red colors:
Random color can generate just specific color type, as long hue, saturation and brightness are not
too limiting this will still give rich result
import 'package:random_color/random_color.dart';

RandomColor _randomColor = RandomColor();

Color _color = _randomColor.randomColor(colorHue: ColorHue.red);
copied to clipboard
Get just red and blue colors:
You can combine multiple hue ranges to choose from
import 'package:random_color/random_color.dart';

RandomColor _randomColor = RandomColor();

Color _color = _randomColor.randomColor(
colorHue: ColorHue.multiple([ColorHue.red, ColorHue.blue])
);
copied to clipboard
Get highly saturated colors:
import 'package:random_color/random_color.dart';

RandomColor _randomColor = RandomColor();

Color _color = _randomColor.randomColor(
colorSaturation: ColorSaturation.highSaturation
);
copied to clipboard
Get light colors:
import 'package:random_color/random_color.dart';

RandomColor _randomColor = RandomColor();

Color _color = _randomColor.randomColor(
colorBrightness: ColorBrightness.light
);
copied to clipboard
Tests #
If you want to run the tests for this project under Flutter Dart
flutter pub pub run test
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.