Skip to content
pubscout

from_css_color

2.0.0, released 6 years ago by an unverified publisher

Creates Flutter Color instances from CSS color strings according to CSS Color Module Level 3.

WASM-ready
$ flutter pub add from_css_color
Source repository

What it does

Parses CSS color strings such as Hex, RGB(A), HSL(A), and X11 keywords into Flutter Color instances. Also provides an extension method to convert a Color back to a CSS color string and a function to check string correctness.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to parse standard CSS color strings in Flutter.
  • You are integrating web-based themes or styles that use CSS colors.
  • You want to convert Flutter Color instances back to CSS color strings.

Skip it when

  • You are working with color spaces outside of CSS Color Module Level 3.

Strengths

  • Supports multiple formats including Hex, RGB(A), HSL(A), and X11 keywords.
  • Includes backwards conversion to CSS color strings via extension method.
  • Provides validation for CSS color strings.

Weaknesses

  • Limited to CSS Color Module Level 3.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:from_css_color/from_css_color.dart';

final color = fromCssColor('#ff00aa');
final cssString = color.toCssString();

Alternatives

Packages that do the same job and could replace from_css_color.