from_css_color 0.1.0 copy "from_css_color: ^0.1.0" to clipboard
from_css_color: ^0.1.0 copied to clipboard

outdated

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

example/from_css_color.dart

import 'package:from_css_color/from_css_color.dart';

// create Color from hex
var hex = fromCSSColor('#fbafba'); // Color(0xFFFBAFBA)
var hexShort = fromCSSColor('#fba'); // Color(0xFFFFBBAA)

// or from rgb
var rgb = fromCSSColor('rgb(100, 5, 32)'); // Color(0xFF640520)
var rgbWithPercents = fromCSSColor('rgb(110%, 0%, 0%)'); //Color(0xFFFF0000)
var rgba = fromCSSColor('rgb(110%, 0%, 0%, 0.5)'); //Color(0x7FFF0000)

// or even from hsl
var hsl = fromCSSColor('hsl(100,50%,10%)'); // Color(0xFF15260C)
var hsla = fromCSSColor('hsla(-120,100%,50%, .5)'); // Color(0x7F0000FF)

// and a list of X11 keywords is supported
var navy = fromCSSColor('navy'); // Color(0xFF000080)
var violet = fromCSSColor('violet'); // Color(0xFFEE82EE)
var transparent = fromCSSColor('transparent'); // Color(0x00000000)
22
likes
0
pub points
100%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on from_css_color