| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Generate visually appealing random colors with ease in your Dart and Flutter projects.
Add this to your package's pubspec.yaml file:
dependencies:
flutter_randomcolor: ^1.0.16Then run:
$ flutter pub getimport 'package:flutter_randomcolor/flutter_randomcolor.dart';
// Generate a random color
var color = RandomColor.getColor(Options());
// Generate a Flutter Color object
Color flutterColor = RandomColor.getColorObject(Options());Generate a random color with default options:
var color = RandomColor.getColor(Options());Get a Color object for direct use in Flutter widgets:
Color widgetColor = RandomColor.getColorObject(Options(
colorType: ColorType.blue,
luminosity: Luminosity.light,
));
// Use in a widget
Container(
color: widgetColor,
child: Text('Colored Container'),
)Fine-tune your color generation:
var customColor = RandomColor.getColor(Options(
colorType: [ColorType.red, ColorType.blue],
luminosity: Luminosity.dark,
format: Format.rgba,
alpha: 0.8,
));Returns a color based on the specified options.
Returns a Flutter Color object based on the specified options.
random, monochrome, red, orange, yellow, green, blue, purple, pink
random, dark, light, bright
rgba, rgb, rgbArray, hsla, hex, hsl, hsva, hsvArray, hslArray
// Bright green color in hex format
var brightGreen = RandomColor.getColor(Options(
colorType: ColorType.green,
luminosity: Luminosity.bright,
format: Format.hex
));
// Array of 5 pastel colors
var pastelColors = RandomColor.getColor(Options(
luminosity: Luminosity.light,
count: 5
));
// Dark red or blue with 50% opacity
var transparentDark = RandomColor.getColor(Options(
colorType: [ColorType.red, ColorType.blue],
luminosity: Luminosity.dark,
format: Format.rgba,
alpha: 0.5
));
// Flutter Color with seed options to return the same color
var seedColor = RandomColor.getColorObject(Options(
colorType: ColorType.red,
luminosity: Luminosity.dark,
format: Format.hex,
seed: 1234
));We welcome contributions! Please see our Contributing Guide for more details.
This project is licensed under the MIT License - see the LICENSE file for details.
| Back | FazBrowse Home | New Git URL |