Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter flutter logo random color generator

this flutter 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 a specific color with slight differences.

blue colors:
blue
red colors:
red
green:
green
low saturation:
low-saturation2
high saturation:
high-saturation
light colors:
light-colors
dark colors:
dark-colors

usage

getting random color:

random color generator 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

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top