Skip to content
/ chroma Public

[Work in progress] A simple library for manipulating colors in Dart.

License

Notifications You must be signed in to change notification settings

jimmyff/chroma

Repository files navigation

Chroma

Build Status Pub Package Version Latest Dartdocs

A simple library for manipulating colors in Dart.

Color model classes

  • RgbColor
  • HslColor
  • HsvColor

Usage

Basic use

final hotPink = new RgbColor(255.0, 105.0, 180.0);

// find the complementary color then convert back to RGB
final complimentary = (hotPink.toHsl()..hue -= 180).toRgb();


// Create from Hex
final seaFoamGreen = new RgbColor.fromHex('#71EEB8');

Conversions

final hsl = hotPink.toHsl();
final hsv = hotPink.toHsv();

Output to Hex or CSS strings

print ("The CSS string for hot pink is ${hotPink.toCss()}");
print ("The Hex string for hot pink is ${hotPink.toHex()}");

Color mixing: Addition & subtraction

// Addition
final red = new RgbColor(255.0, 0.0, 0.0);
final blue = new RgbColor(0.0, 0.0, 255.0);
final magenta = red + blue;

// Subtraction
final green = new RgbColor(0.0, 255.0, 0.0);
final white = magenta + green;
final yellow = white - blue;

About

[Work in progress] A simple library for manipulating colors in Dart.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages