setalpha 0.9.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 62

setalpha

A convenience package for setting and accessing web colors, adjusting the alpha levels of given colors and mixing new colors.

Usage

A simple usage example:

import 'package:setalpha/setalpha.dart';

void main() {
  // Get cornflowerblue with an alpha value of 0.3...
  print(setAlpha(Color.cornflowerBlue, 0.3));
  // #6495ED4D

  // Also works for other hex and hsl expressions...
  print(setAlpha("#6495ED", 0.5));
  // #6495ED80

  print(setAlpha("hsl(218.54deg, 79%, 66%)", 0.5));
  // #6495ED80

  // Which web color is nearest cornflourblue in RGB-space?
  print(colorsNearest(Color.cornflowerBlue, 2).last);
  // mediumslateblue

  // Let's mix 3 parts cornflowerblue with 2 parts maroon...
  print(colorMix([Color.cornflowerBlue, Color.maroon], [3, 2]));
  // #6F598EFF
}

Demos

A little app that demonstrates color manipulation, component data, finding similar colors and setting alpha levels using setalpha.

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

0.9.3

  • Small additions and amendments to the ColorProperties class.

  • Fixed a bug in the interpretation of hsla expressions.

  • The colorsNearest function has been split into colorsNearestRGB and colorsNearestHSL that respectively return the nearest colors in RGB-space and HSL-space.

  • Added a convenience class Crayon that provides access to the crayon colors in the html color picker.

0.9.2

Dart pub issues (?)

0.9.1

  • Fixed several bugs that were introduced in the previous version.
  • Changed colorNearestRGB to a more generic and useful colorsNearest, which returns a list of colors in order of increasing distance. (Breaking change.)
  • Cleaned up the code: a lot more readable now.

0.9.0

  • Marked as ready for Dart 2.
  • Removed methods from abstract class Color: free-standing functions setAlpha, colorMix and colorNearestRGB are more convenient. (This is a breaking change.)
  • Output of setAlpha now an 8 digit hex value, matching the output of colorMix.
  • Added an abstract ColorProperty class that provides access to various qualities of an input color such as hue, saturation and lightness.

0.8.0

Added the function Color.mix, which allows us to mix a list of colors.

0.7.0

Added the function Color.nearest, which returns the css color nearest in rgb space to input rgb values.

0.6.0

Now also supports hsl expressions as input to function setAlpha.

0.5.0

  • Set the alpha level of CSS colors.
  • Supports color name, hex values, rgb (and rgba) expressions as input to the function setAlpha.

example/example.dart

import 'package:setalpha/setalpha.dart';

void main() {
  // Get cornflowerblue with an alpha value of 0.3...
  print(setAlpha(Color.cornflowerBlue, 0.3));
  // #6495ED4D

  // Also works for other hex and hsl expressions...
  print(setAlpha("#6495ED", 0.5));
  // #6495ED80

  print(setAlpha("hsl(218.54deg, 79%, 66%)", 0.5));
  // #6495ED80

  // Which web color is nearest cornflourblue in RGB-space?
  print(colorsNearestRGB(Color.cornflowerBlue, 2).last);
  // mediumslateblue

  // Let's mix 3 parts cornflowerblue with 2 parts maroon...
  print(colorMix([Color.cornflowerBlue, Color.maroon], [3, 2]));
  // #6F598EFF
}

Use this package as a library

1. Depend on it

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


dependencies:
  setalpha: ^0.9.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:setalpha/setalpha.dart';
  
Version Uploaded Documentation Archive
0.9.3 Aug 8, 2018 Go to the documentation of setalpha 0.9.3 Download setalpha 0.9.3 archive
0.9.2 Aug 4, 2018 Go to the documentation of setalpha 0.9.2 Download setalpha 0.9.2 archive
0.9.1 Aug 4, 2018 Go to the documentation of setalpha 0.9.1 Download setalpha 0.9.1 archive
0.9.0 Aug 3, 2018 Go to the documentation of setalpha 0.9.0 Download setalpha 0.9.0 archive
0.8.0 Oct 12, 2017 Go to the documentation of setalpha 0.8.0 Download setalpha 0.8.0 archive
0.7.0 Sep 30, 2017 Go to the documentation of setalpha 0.7.0 Download setalpha 0.7.0 archive
0.6.0 Sep 23, 2017 Go to the documentation of setalpha 0.6.0 Download setalpha 0.6.0 archive
0.5.1 Sep 21, 2017 Go to the documentation of setalpha 0.5.1 Download setalpha 0.5.1 archive
0.5.0 Sep 21, 2017 Go to the documentation of setalpha 0.5.0 Download setalpha 0.5.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
24
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]
62
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:setalpha/setalpha.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.69.3 <3.0.0