color 1.2.0

  • README.md
  • changelog
  • Installing
  • Versions
  • --

Color #

A simple Dart package exposing a Color class which can be used to create, convert, and compare colors.

Installation #

  1. Add this to your package's pubspec.yaml file:
dependencies:
  color: any
  1. Get the package using your IDE's GUI or via command line with
$ pub get
  1. Import the color.dart file in your app
import 'package:color/color.dart';

Usage #

Color objects can be constructed using any of a few available constructors.

To create a color from rgb values, call

Color rgbColor = new Color.rgb(192, 255, 238);

Alternatively, a color can be created from a string containing a hex value with

Color hexColor = new Color.hex('c0ffee');

Regardless of how a color is constructed, its value is internally stored as rgb values and is accessed the same as any other color.

Colors can be compared using the == operator, which will evaluate to true if the two colors share identical rgb values.

assert(new Color.hex('c0ffee') == new Color.hex('c0ffee'));
0.1.0
-----
* Creation of the Color class supporting rgb colors.

0.2.0
-----
* Added hex support and conversion functions.

0.3.0
-----
* Added hsl support and conversion functions.

0.3.1
-----
* Resolved bug where Color.toHexString() was not prepending each byte with 0s as appropriate.
* Added Color.toRgbString() as an alias for Color.toSting().

1.0.0
-----
* Major refactor which will break code using earlier versions.
* Refactored to pull each color space into its own subclass extending a base Color class.

1.1.0
-----
Added XYZ color space support with bidirectional conversions between XYZ and RGB color spaces.

1.2.0
-----
Added CIELAB color space support with bidirectional conversions with the XYZ color space (and the RGB color space using XYZ as an intermediary).

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  color: ^1.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:color/color.dart';
  
Version Uploaded Documentation Archive
2.1.1 Oct 8, 2018 Go to the documentation of color 2.1.1 Download color 2.1.1 archive
2.0.2 Jul 3, 2017 Go to the documentation of color 2.0.2 Download color 2.0.2 archive
2.0.1 Mar 14, 2017 Go to the documentation of color 2.0.1 Download color 2.0.1 archive
2.0.0 Jun 24, 2015 Go to the documentation of color 2.0.0 Download color 2.0.0 archive
1.3.0 Apr 3, 2015 Go to the documentation of color 1.3.0 Download color 1.3.0 archive
1.2.0 Jan 21, 2015 Go to the documentation of color 1.2.0 Download color 1.2.0 archive
0.3.1 May 27, 2014 Go to the documentation of color 0.3.1 Download color 0.3.1 archive
0.3.0 Jan 30, 2014 Go to the documentation of color 0.3.0 Download color 0.3.0 archive
0.2.0 Jan 27, 2014 Go to the documentation of color 0.2.0 Download color 0.2.0 archive
0.1.0 Jan 26, 2014 Go to the documentation of color 0.1.0 Download color 0.1.0 archive
Awaiting analysis to complete.