toString is returning rgba value but toHexString is returning a different value
ivikash opened this issue · 2 comments
ivikash commented
Hi,
.toHexString() is not returning the expected value. Attaching a runkit.
https://runkit.com/embed/dhv39902sm0k
var tinycolor2 = require("tinycolor2")
const sheetsDefault = "#00857A"
const color =
console.log(tinycolor2(sheetsDefault).setAlpha(0.5).toString())
console.log(tinycolor2(sheetsDefault).setAlpha(0.5).toHexString())
davegomez commented
It seems the library doesn't have support for the Alpha channel in HEX values @ivikash. But in theory, is returning the correct value.
davegomez commented
@ivikash just noticed that you are not using the toHex8String
method.
var tinycolor2 = require("tinycolor2")
const sheetsDefault = "#00857A"
console.log(tinycolor2(sheetsDefault).setAlpha(0.5).toString()). // "rgba(0, 133, 122, 0.5)"
console.log(tinycolor2(sheetsDefault).setAlpha(0.5).toHex8String()). // "#00857a80"