Open silverWolf818 opened 3 years ago
mac os chrome 84 ver
Experiencing the same issue on version 2.18.1. Had to use the solution suggested in this thread.
I had the same problem on chrome mac
Install the previous version using
npm install react-color@2.17.3 --save
Restart the app and you're done!
Install the previous version 2.17.3
Unfortunately this did not help. At least for Chrome (Linux).
@dmitriy-komarov try this:
const decimalToHex = (alpha: number) => alpha === 0 ? '00' : Math.round(255 * alpha).toString(16)
const handleColorChange = (color: ColorResult) => {
const hexCode = `${c.hex}${decimalToHex(c.rgb.a)}`
}
Solution from the thread I linked.
@Dror-Bar, thx, it worked. I suppose this code should be added into the project.
@dmitriy-komarov try this:
const decimalToHex = (alpha: number) => alpha === 0 ? '00' : Math.round(255 * alpha).toString(16) const handleColorChange = (color: ColorResult) => { const hexCode = `${c.hex}${decimalToHex(c.rgb.a)}` }
Solution from the thread I linked.
enhance version
const decimalToHex = (alpha: number) => { let aHex = Math.round(255 * alpha).toString(16); return alpha === 0 ? '00' : aHex.length < 2 ? `0${aHex}` : aHex; }
const handleColorChange = (color: ColorResult) => { const hexCode = `${color.hex}${decimalToHex(color?.rgb?.a ?? defaultAlpha)}`; };
@yaeSakuras , any update for this issue?
@dmitriy-komarov try this:
const decimalToHex = (alpha: number) => alpha === 0 ? '00' : Math.round(255 * alpha).toString(16) const handleColorChange = (color: ColorResult) => { const hexCode = `${c.hex}${decimalToHex(c.rgb.a)}` }
Solution from the thread I linked.
enhance version
const decimalToHex = (alpha: number) => { let aHex = Math.round(255 * alpha).toString(16); return alpha === 0 ? '00' : aHex.length < 2 ? `0${aHex}` : aHex; }
const handleColorChange = (color: ColorResult) => { const hexCode = `${color.hex}${decimalToHex(color?.rgb?.a ?? defaultAlpha)}`; };
this work, thx
alpha slider unable to work