# from_css_color 2.0.0

Creates Color instance from CSS color string according to https://drafts.csswg.org/css-color-3




## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add from_css_color
```
Published: 2021-03-31T11:59:29.484564Z
Expected archive SHA-256: 5e4d1795c8d10af94e51dd97636b2a29170a132be1aceba103e9866028d20823

Available in cache; verification: upstream_checksum
## Direct dependencies
- flutter: map[sdk:flutter]

## Package README (untrusted upstream documentation)
# From CSS Color

A package that creates Flutter Color instances from CSS color strings according to [CSS Color Module Level 3](https://drafts.csswg.org/css-color-3).
Hex, RGB(A), HSL(A) and X11 keywords are supported.

Backwards conversion from Color to CSS color string is also available with `toCssColor()` extention method.

## Usage

To use this plugin, add `from_css_color` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).

## Example

Import the library.

```dart
import 'package:from_css_color/from_css_color.dart';
```

Use it anywhere you want to create a Color from CSS color definition format:

```dart
Container(
  color: fromCssColor('#ff00aa'),
  // ...
)

Container(
  color: fromCssColor('rgb(100, 5, 32)'),
  // ...
)
```

Convert Color back to CSS string:

```dart
final color = const Color(0xFFFBAFBA);

color.toCssString(); // '#fbafba'
```

Check CSS color string correctness:

```dart
isCssColor('#ff00aa'); // true
```

Visit examples for more details.

## Changelog
## 2.0.0

* Migrate to null-safety.
* Remove fromCSSColor()/isCSSColor(), which was deprecated since 1.2.0 in favor of fromCssColor()/isCssColor() to meet the [effective Dart style guide](https://dart.dev/guides/language/effective-dart/style#do-capitalize-acronyms-and-abbreviations-longer-than-two-letters-like-words).

## 1.2.0

* Add `isCssColor()` function to check color string format correctness.

## 1.1.0

* Add `toCssColor()` extension method to convert Color instance to CSS color string.

## 1.0.0

* Add support for 4 (#rgba) and 8 (#rrggbbaa) digit hex colors.
* Update versioning to stable after 3 months of usage in production (no breaking changes expected).

## 0.1.1

* Update readme and file formatting.

## 0.1.0

* Support for 'transparent' color keyword.
* Support for hsl/hsla colors.

## 0.0.1

* Support for 3 and 6 digit hex colors.
* Support for rgb/rgba colors.
* Support for X11 keywords.







 
