github parcel-bundler/lightningcss v1.16.0

latest releases: v1.28.0, v1.27.0, v2.26.0...
2 years ago

This release adds support for the new relative color syntax, improves support for quoted CSS animation names, and fixes some bugs.

Relative color syntax

Lightning CSS now supports the new relative color syntax in the CSS Color Level 5 spec! This allows you to use math functions like calc() to manipulate the channel values of a source color, and to convert between color spaces. This is not yet shipping in any browsers, but Lightning CSS will do this manipulation at build time when possible, so that it works in any browser today!

Here's a simple example, which uses the lch color space to darken slateblue by 10%. This is done by using the l channel value in a calc() expression, and preserving the c and h channels as is.

.foo {
  color: lch(from slateblue calc(l - 10%) c h);
}

This will output:

.foo {
  color: lch(34.5711% 65.7776 296.794);
}

And, when lch colors are not supported by your browser targets, Lightning CSS already supports outputting fallbacks for older browsers:

.foo {
  color: #4e42b1;
  color: lch(34.5711% 65.7776 296.794);
}

Check it out in the playground!

Note that due to being a build time transform, CSS variables are not supported as source colors since the variable value may change at runtime. We'll have to wait for browser support for that.

Other fixes and improvements

  • Support for parsing the border-spacing property – @yisibl in #294
  • Avoid converting animation: "none" to animation: "none" none@yisibl in #295
  • If the browser doesn't support #rrggbbaa color syntax, output transparent instead of rgba(0, 0, 0, 0)@yisibl in #296
  • Support parsing angles with unitless zero in gradients and transforms – cbd392f
  • Bump parcel_sourcemap dependency to fix parsing source maps without sourcesContent, and improve base64 performance – 061c0c2

Don't miss a new lightningcss release

NewReleases is sending notifications on new releases.