Color definition, manipulation, conversion, and comparison in fluent Dart.

On Code coverage Github action status Dartdocs Style guide


Provides platform-agnostic (i.e. CLI, Flutter, Web) classes and conventions for defining (creating or parsing from popular formats), manipulating (changing elements like brightness, hue, saturation, etc), conversion (from/to popular formats), and comparison (sometimes called "distance") Color elements.


If you've used Flutter's Color class, you'll feel at home:

import 'package:neocolor/neocolor.dart';

void main() {
  const c1 = Color(0xFF42A5F5);
  const c2 = Color.fromARGB(0xFF, 0x42, 0xA5, 0xF5);
  print('$c1 == $c2: ${c1 == c2}');

  const c3 = Color.fromARGB(255, 66, 165, 245);
  const c4 = Color.fromRGBO(66, 165, 245, 1.0);
  print('$c3 == $c4: ${c3 == c4}');

  // NEW: Use HSB (sometimes called HSV) and HSL to create colors too!
  final c5 = Color.fromHSB(206.8, 0.7306, 0.9608);
  final c6 = Color.fromHSL(206.8, 0.8990, 0.6100);
  print('$c5 == $c6: ${c5 == c6}');


This package welcomes new issues and pull requests.

Changes or requests that do not match the following criteria will be rejected:

  1. Common decency as described by the Contributor Covenant.
  2. Making this library brittle/extensible by other libraries.
  3. Adding platform-specific functionality.
  4. A somewhat arbitrary bar of "complexity", everything should be easy to use.


Packages already exist that tackle this problem, often in similar ways:

If one of these packages suits your needs better, use it instead!