color 0.2.0

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
    
  2. Get the package using your IDE's GUI or via command line with

     $ pub get
    
  3. 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'));

Use this package as a library

1. Depend on it

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


dependencies:
  color: ^0.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';
  
Awaiting analysis to complete.

Admin