setalpha 0.8.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 54

setalpha

A library for conveniently setting the alpha level of a CSS color.

Usage

A simple usage example:

import 'package:setalpha/setalpha.dart';

void main() {
  // CSS color "lightblue" with an alpha value of 0.5.
  String desiredResult = "rgba(173,216,230,0.5)";

  // Use a CSS color name...
  assert(setAlpha("lightblue", 0.5) == desiredResult);
  
  // Or a CSS hex value...
  assert(setAlpha("#add8e6", 0.5) == desiredResult);

  // Or a CSS hsl value...
  assert(setAlpha("hsl(195, 53%, 79%)", 0.5) == desiredResult);
  
  // Or a CSS rgb expression...
  assert(setAlpha("rgb(173,216,230)", 0.5) == desiredResult);
  
  // Or using the convenience class Color...
  assert(setAlpha(Color.lightBlue, 0.5) == desiredResult);

  // What is the css color nearest in rgb space to the
  // rgb coordinates (145, 138, 236)?
  assert(Color.nearest(145, 138, 236) == "cornflowerblue");
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

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.

0.6.0

Now also supports hsl expressions as input to function setAlpha.

0.7.0

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

0.8.0

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

Use this package as a library

1. Depend on it

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


dependencies:
  setalpha: "^0.8.0"

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.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

Analysis

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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

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

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • Homepage does not exists.

    We were unable to access https://ram6ler@bitbucket.org/ram6ler/setalpha at the time of the analysis.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use setalpha.dart.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Strong-mode analysis of lib/src/color.dart gave the following hint:

    line: 318 col: 50
    'INFINITY' is deprecated and shouldn't be used.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
Dev dependencies
test ^0.12.0