flutter_color_analyzer 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 56

flutter_color_analyzer #

Build Status codecov

flutter_color_analyzer offers utilities for analyzing perceptual differences between colors in order to choose optimal color palettes in an accessible way.

Examples #

ColorAnalyzer.noticeablyDifferent #

Based on [1] determine if two colors are noticeably different or not. By default use a model that empirically matches results for 50% of observers noticing a different for color patches with a visual angle of 0.1 degrees (around 0.5cm size viewed from 30cm distance).

import 'package:flutter/material.dart';
import 'package:flutter_color_analyzer/big_color.dart';

void main() {
    final lightBlueAccent = BigColor.fromColor(Colors.lightBlueAccent);
    final lightBlue = BigColor.fromColor(Colors.lightBlue);
    final areNoticeablyDifferent = ColorAnalyzer.noticeablyDifferent(lightBlueAccent, lightBlue);

    // areNoticeablyDifferent is false, because based on the model 50% of observers do not
    // notice a different between lightBlueAccent and lightBlue with a visual angle of 0.1
    // degrees
}

References #

  1. Stone, Maureen C., Danielle Albers Szafir and Vidya Setlur. “An Engineering Model for Color Difference as a Function of Size.” (2014).

[0.1.0] - 2020-05-10 #

  • Initial release.
  • Wrapper around Flutter Color class to calculate Lab components.
  • Determine if two colors are noticeably different or not. See code for research paper references.

example/README.md

ColorAnalyzer.noticeablyDifferent #

Based on [1] determine if two colors are noticeably different or not. By default use a model that empirically matches results for 50% of observers noticing a different for color patches with a visual angle of 0.1 degrees (around 0.05cm size viewed from 30cm distance).

import 'package:flutter/material.dart';
import 'package:flutter_color_analyzer/big_color.dart';

void main() {
    final lightBlueAccent = BigColor.fromColor(Colors.lightBlueAccent);
    final lightBlue = BigColor.fromColor(Colors.lightBlue);
    final areNoticeablyDifferent = ColorAnalyzer.noticeablyDifferent(lightBlueAccent, lightBlue);

    // areNoticeablyDifferent is false, because based on the model 50% of observers do not
    // notice a different between lightBlueAccent and lightBlue with a visual angle of 0.1
    // degrees
}

References #

  1. Stone, Maureen C., Danielle Albers Szafir and Vidya Setlur. “An Engineering Model for Color Difference as a Function of Size.” (2014).

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_color_analyzer: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:flutter_color_analyzer/flutter_color_analyzer.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
12
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]
56
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 completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [flutter_color_analyzer] that is in a package requiring null.

Health suggestions

Format lib/big_color.dart.

Run flutter format to format lib/big_color.dart.

Format lib/flutter_color_analyzer.dart.

Run flutter format to format lib/flutter_color_analyzer.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test
pedantic ^1.9.0