Skip to content
pubscout

rainbow_color

2.0.1, released 6 years ago by starheightmedia.com

Interpolate numeric values to a multi‑color range with a simple API.

WASM-ready
$ flutter pub add rainbow_color
Source repository

What it does

Provides a Rainbow class that maps a numeric domain to a smooth gradient of two or more colors. Includes RainbowColorTween for use in Flutter animations as a drop‑in replacement for ColorTween.

AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to map data values to colors for charts or visualizations
  • You want smooth multi‑color transitions in animations without building a TweenSequence

Skip it when

  • You require a full theming engine or palette management
  • You need advanced color manipulation beyond linear interpolation

Strengths

  • Simple, declarative API for color interpolation
  • Supports any number of colors in the spectrum
  • Integrates with Flutter animation system via RainbowColorTween

Weaknesses

  • Only handles color interpolation, no broader theming features
  • No support for non‑Flutter platforms directly

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
import 'package:rainbow_color/rainbow_color.dart';

var rb = Rainbow(
  spectrum: [Color(0xFFFF0000), Color(0xFFFFFFFF), Color(0xFF00FF00)],
  rangeStart: -10,
  rangeEnd: 10,
);
Color warm = rb[-9.32];
Color cold = rb[8.44];

Alternatives

Packages that do the same job and could replace rainbow_color.