Closed phuze closed 2 years ago
I'll follow this up by noting for anyone else reading, you can resolve this by mapping the array yourself:
pickr.setColor('#9C27B0')
let fixedRgba = `rgba(${pickr.getColor().toRGBA().map( num => { return Math.round(num) }).join(', ')})`;
console.log('fixedRgba', fixedRgba)
// returns rgba(156, 39, 176, 1)
also you can use .toString(0)
pickr.getColor().toRGBA().toString(0)
it is documented on readme.
Correct way of solving this, thanks @saeedxnazari :)
What is the current behavior?
When you convert a color to it's RGBA equivalent, it results in a rather lengthy floating point:
Please provide the steps to reproduce and create a JSFiddle.
Look at the console in this fiddle: https://jsfiddle.net/urp52z60/
What is the expected behavior?
A well-formed value that adheres to the expected RGBA color model. Expected output:
rgba(156, 39, 176, 1)
Your environment:
Version:
1.8.1
Used bundle:modern
Used theme:classic
Browser-version:Edge 92.0.902.67
Operating-system:Windows 10