jquery-asColorPicker icon indicating copy to clipboard operation
jquery-asColorPicker copied to clipboard

Set color not working with gradient

Open vibrantBits opened this issue 7 years ago • 2 comments

Checklist

  • [ ] I'm using version [0.4.3]
  • [ ] My browser is: Google Chrome 63.0.3239.132 (64 bits)

Description

Trying to set a gradient value with the API is not working. It looks that this is a bug or actually there is no explicit way to achieve this. Anyone with same problem / workaround?

The picker is in 'gradient' mode.

How can we reproduce this bug?

  1. Try to set a gradient value. $().asColorPicker('val', 'linear-gradient(to top, rgb(126, 13, 192) 0%, rgb(48, 8, 8) 100%)');

What did you expect to happen?

Gradient should be set in the input and in the trigger just as when a flat color is set.

What happened instead?

The input becomes empty and the trigger loads flat white color no matter what gradient colors were used.

vibrantBits avatar Jan 09 '18 16:01 vibrantBits

Any progress with this? I'm having the same issue.

jonalxh avatar Jun 13 '19 15:06 jonalxh

  1. Try to set a gradient value. $().asColorPicker('val', 'linear-gradient(to top, rgb(126, 13, 192) 0%, rgb(48, 8, 8) 100%)');

You need to call the api using your input class (maybe it's not very clear). I do what you describe doing

var picker = $("#backgroundGradient");
picker.asColorPicker({
            mode:'gradient'
        });
picker.asColorPicker('val', "linear-gradient(to top, rgb(126, 13, 192) 0%, rgb(48, 8, 8) 100%)");

And it function for me.

MCiocio avatar Dec 17 '20 11:12 MCiocio