css-color-function icon indicating copy to clipboard operation
css-color-function copied to clipboard

parse error when blend with hsl()

Open FourwingsY opened this issue 9 years ago • 6 comments

.test {
  color: color(hsl(210, 10%, 85%) blend(hsl(330, 50%, 70%) 50%));
}

Error message says: Unable to parse color from string "hsl(330," can get the bug here too: http://cssnext.io/playground/

FourwingsY avatar Sep 02 '16 09:09 FourwingsY

I also have this problem (see https://github.com/MoOx/postcss-cssnext/issues/363). It seems that the blend function only works with simple color names (like red or rebeccapurple) and # but doesn't with rgb() or hsl()

magicznyleszek avatar Mar 31 '17 06:03 magicznyleszek

I also hit the same issue.

kopax avatar Sep 26 '17 02:09 kopax

Same issue with Sass's lighten/darken functions

benweiser avatar Oct 23 '17 02:10 benweiser

#23 the same

Semigradsky avatar Nov 05 '17 19:11 Semigradsky

Is there any way to silence these messages? The function works correctly for me, just throws that error.

feimosi avatar Apr 12 '18 21:04 feimosi

If anyone else finds this thread, I fixed it by re-ordering the postcss plugins(I'm using webpack setup).

For this to work and interpret a variable, it needs to come after the plugin that handles variables.

For my setup: Didn't work, showed "Unable to parse color from string" error:

plugins: () => [
    ...
    require('postcss-css-color-function'),
    require('postcss-mixins'),
    require('postcss-nested'),
    require('postcss-simple-vars'),
    require('postcss-calc'),
    ...
]

WORKS, no error:

plugins: () => [
    ...
    require('postcss-mixins'),
    require('postcss-nested'),
    require('postcss-simple-vars'),
    require('postcss-css-color-function'),
    require('postcss-calc'),
    ...
]

mooreInteractive avatar Jun 20 '18 22:06 mooreInteractive