quantize_dart 1.0.3

quantize_dart #

The Dart implementation of quantize, based on quantize.

Usage #

import 'package:quantize_dart/quantize_dart.dart';

final arrayOfPixels = [[190,197,190], [202,204,200], [207,214,210], [211,214,211], [205,207,207]];
final maximumColorCount = 4;

final colorMap = quantize(arrayOfPixels, maximumColorCount);
  • arrayOfPixels - A list of pixels (represented as [R,G,B arrays]) to quantize
  • maxiumColorCount - The maximum number of colours allowed in the reduced palette

Reduced Palette #

The .palette() method returns a list that contains the reduced color palette.

// Returns the reduced palette
colorMap.palette(); 
// [[204, 204, 204], [208,212,212], [188,196,188], [212,204,196]]

Reduced pixel #

The .map(pixel) method maps an individual pixel to the reduced color palette.

// Returns the reduced pixel
colorMap.map(arrayOfPixels[0]);
// [188,196,188]

License #

Licensed under the MIT License.

1.0.0 #

Initialize publish.

1.0.1 #

Remove unnecessary new keyword.

1.0.2 #

Add list get check.

1.0.3 #

Strict list get check.

example/main.dart

import 'package:quantize_dart/quantize_dart.dart';

void main() {

  final arrayOfPixels = [[190,197,190], [202,204,200], [207,214,210], [211,214,211], [205,207,207]];
  final maximumColorCount = 4;
  final colorMap = quantize(arrayOfPixels, maximumColorCount);

  final palette = [[204,204,204], [208,212,212], [188,196,188], [212,204,196]];
  print(palette);

  final palette2 = colorMap.map(arrayOfPixels[0]);
  print(palette2);

}

Use this package as a library

1. Depend on it

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


dependencies:
  quantize_dart: ^1.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:quantize_dart/quantize_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5

Health issues and suggestions

Document public APIs. (-0.45 points)

53 out of 54 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/quantize_dart.dart.

Run dartfmt to format lib/quantize_dart.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
Dev dependencies
test ^1.0.0