rainbow_vis 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 26

Pub Travis

Color data visualization; easily map numbers to a smooth-transitioning color legend. This is a port of the RainbowVis-JS written by anomal.

Usage #

To interpolate a color among the spectrum, use the list access operator, e.g.

var rb = Rainbow(spectrum: ["#ff0000", 'white', '00FF00'],
                 rangeStart: -10,
                 rangeEnd: 10);
var myColdColor = rb0[-9.32];
var myWarmColor = rb0[8.44];

Testing #

To run on vm (default): pub run test As usual, tests can be run on other platforms with -p<platform>

See Also #

For a Flutter-specific version of this package, see rainbow_color which interfaces with Color objects and provides additional tween support.

0.0.1 #

  • Initial version

1.0.0 #

  • Updated to Dart 2

1.0.1 #

  • Support alpha; if one or more colors include alpha then interpolations will include

1.0.2 #

  • Fix bug when alpha provided with leading hash symbol

1.0.3 #

  • readme

example/rainbow_vis_example.dart

import 'package:rainbow_vis/rainbow_vis.dart';

void main() {
  print("Red -> White -> Green");
  var rwg = Rainbow(
      spectrum: ["#ff0000", 'white', '00FF00'],
      rangeStart: -0.5,
      rangeEnd: 0.5);
  for (var v = -1.0; v <= 1.0; v = v + .25) {
    print('rwgb[$v] -> ${rwg[v]}');
  }
  print('');

  print("Red -> Blue");
  var rb = Rainbow(spectrum: ['red', 'blue'], rangeStart: 0, rangeEnd: 10);
  for (var i = 0; i <= 3; i++) {
    var third = 10 * i / 3;
    print('rb[$third] -> ${rb[third]}');
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  rainbow_vis: ^1.0.3

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:rainbow_vis/rainbow_vis.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
26
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status aborted using:

  • Dart:
  • pana:

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0