flutter_html_css_color 0.2.0 copy "flutter_html_css_color: ^0.2.0" to clipboard
flutter_html_css_color: ^0.2.0 copied to clipboard

A flutter_html extension that corrects the CSS colours flutter_html 3.0.0 mis-reads or drops: 8-digit hex, hsl(), the space-separated syntax, hwb() and 148 named colours.

0.2.0 #

  • Renamed from flutter_html_css_color_extension on pub.flutter-io.cn. The old package stays published and is marked discontinued with this one as its replacement. Class names are unchanged.

0.1.0 #

  • Initial release. flutter_html 3.0.0 gets a surprising amount of CSS colour wrong and says nothing about it. An 8-digit #rrggbbaa is read as a Dart 0xAARRGGBB literal, so every channel lands one place along and #00ff0040 comes out invisible; #rgba is worse, because only the 3-digit shorthand gets expanded. The space-separated rgb(255 0 0) and rgb(255 0 0 / a) are dropped, so is a percentage channel, and an out-of-range one wraps instead of clamping. hsl() in that syntax renders black rather than falling back, and a hue outside 0 to 360 trips an assertion. hwb(), rebeccapurple, transparent and currentColor are dropped, and aliceblue is a saturated blue because csslib holds it as five hex digits. Two text-shadow values throw a null-check error, in release as well as debug. All of it is measured and pinned; doc/colors.md has the table.
  • The fix is deliberately small: one rewrite of the inline style attribute at the preStyling step, into the legacy rgba(r, g, b, a) form flutter_html already reads without loss. That reaches color, background-color, border and its four sides, text-decoration-color and text-shadow in one go, and it lands before the parser, which is the only place the two throwing values can be caught.
  • If you register flutter_html_css_border_radius as well, list this one before it. Both match at the preStyling step and run in registration order, and that package reads border with a colour parser of its own that knows six names and no hsl(). Listed second, a border: 2px solid hsl(0 100% 50%) clip comes out black.
  • border-color, the border-*-color longhands, the logical border shorthands and outline get the same rewrite, even though flutter_html has no case for them and drops the declaration whatever the token says. The reason is flutter_html_css_border, which folds those longhands into a border shorthand at the same preStyling step and passes the colour token through as written. With the longhands skipped, that fold carried a raw hsl() whenever this extension ran first, and flutter_html read it as black. Now border-color: hsl(0 100% 50%) comes out red in either order, and the order test pins both.
0
likes
160
points
48
downloads

Documentation

API reference

Publisher

verified publisherchaosworld.cc

Weekly Downloads

A flutter_html extension that corrects the CSS colours flutter_html 3.0.0 mis-reads or drops: 8-digit hex, hsl(), the space-separated syntax, hwb() and 148 named colours.

Repository (GitLab)
View/report issues
Contributing

Topics

#flutter-html #css #html #extension #color

License

MPL-2.0 (license)

Dependencies

flutter, flutter_html, html

More

Packages that depend on flutter_html_css_color