# from_css_color 1.2.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:1.2.0'
```
Published: 2021-01-05T22:18:43.885283Z
Expected archive SHA-256: b1aa15633aa269e53edd1de1e3c0476d69d979fa4fa2b7b8d2c600b59db27870

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







 
