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

Get hex + alpha #292

Open
MichaelPruefer opened this issue Jun 15, 2020 · 1 comment
Open

Get hex + alpha #292

MichaelPruefer opened this issue Jun 15, 2020 · 1 comment

Comments

@MichaelPruefer
Copy link

Is it possible to retrieve the alpha value when using color.hex on ColorEvent?

it would be better than doing

let hexValue = colorEvent.color.hex || '';
  if (hexValue.length === 7) {
    hexValue += Math.round(colorEvent.color.rgb.a * 255).toString(16);
}
@nzbin
Copy link

nzbin commented Dec 9, 2021

I am also confused with this issue. It's really inconvenient without hex8 format. I have solved it with @ctrl/tinycolor which used by ngx-color.

new TinyColor(e.color.rgb).toHex8String()

You can check the colorpicker example.

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