Search packages, repositories and app categories

random_color cover
Package detailsv1.0.5

random_color

Generate random colors from hue, saturation and brightness that are visualy appearing. You can chose exact color specifications.

30-day downloads
6.1K
Likes
152
Pub points
30

Install package

flutter pub add random_color

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The random_color package generates visually pleasing random colors by adjusting hue, saturation, and brightness. It allows users to define specific color parameters for consistent, aesthetically balanced results. Ideal for dynamic UIs, theme generation, or visual design tools, it ensures colors appear harmonious on screen. The package is lightweight and easy to integrate, supporting customization while maintaining visual quality. It's particularly useful when a variety of distinct yet attractive colors are needed without manual selection.

Use cases

  • Dynamic UI theme generation
  • Visual design tooling
  • Game element coloring
  • Data visualization
  • User interface prototyping

Key features

  • Hue, saturation, and brightness control
  • Visually appealing color output
  • Customizable color specifications
  • Simple integration with Flutter
  • Lightweight and fast

Suitable for

  • Flutter developers needing random colors
  • Designers creating dynamic interfaces
  • Apps requiring varied color schemes
  • Educational apps with visual elements
  • Prototyping tools

Considerations

  • No platform-specific limitations mentioned
  • Does not support color palettes
  • Limited to RGB-based color generation
  • No built-in color harmony rules beyond basic settings
  • Requires manual handling of color contrast

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Random color generator

pub package CodeFactor

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();
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);
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);
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])
);
Get highly saturated colors:
import 'package:random_color/random_color.dart';

RandomColor _randomColor = RandomColor();

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

RandomColor _randomColor = RandomColor();

Color _color = _randomColor.randomColor(
  colorBrightness: ColorBrightness.light
);
Tests

If you want to run the tests for this project under Flutter Dart

flutter pub pub run test

Categories

Source repository

Projects using this package