Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toString is returning rgba value but toHexString is returning a different value #207

Open
ivikash opened this issue Apr 10, 2019 · 2 comments

Comments

@ivikash
Copy link

ivikash commented Apr 10, 2019

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
Copy link

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
Copy link

davegomez commented Nov 4, 2020

@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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants