react-color icon indicating copy to clipboard operation
react-color copied to clipboard

8 digit hex codes

Open davvidbaker opened this issue 8 years ago • 3 comments
trafficstars

Hey awesome thing you've got here!

What do you think about 8 digit hex codes, as explained here? The rightmost 2 digits represent alpha value.

I know apps like Photoshop don't use them, so maybe they'd only be implemented for the pickers that do use them. I know Chrome does.

I'd be happy to PR, but if you are rethinking color conversions for v3, maybe this is something that should be done on the color conversion library level? Let me know if you have any thoughts!

davvidbaker avatar Sep 06 '17 08:09 davvidbaker

I will keep track of this to make sure it makes it into v3.0.0

casesandberg avatar Jan 23 '19 23:01 casesandberg

Raised this PR for resolving this. @casesandberg

dvj1988 avatar Feb 19 '21 21:02 dvj1988

Any updates on this/ when it might be launched to production?

Also, any suggestions for what I could do in the meantime? My use case is that I want to use the AlphaPicker + HuePicker to interact with an 8 digit hex code that I will be receiving from another component. My current logic was:

  • Get 8 digit hex code from another component, eg. #ffffff80
  • Split it into 6 digit hex + alpha channel hex: #ffffff and 80
  • Convert 80 to decimal then divide by 255 to get alpha as 0.50
  • Feed the two values to hue picker and alpha picker
  • Suppose the use now changes hue picker to red = #ff0000 and alpha to 1.0
  • Convert alpha to corresponding hex code = ff
  • Append the two values = #ff0000ff and then send back to component

However, this seems cumbersome/ inefficient and susceptible to errors. Is there a more elegant/ alternate solutions for the problem?

Note: I MUST use 8 digit hex codes to communicate between the two components, don't have a choice there :/

Anyway, I appreciate any help and thank you for such an amazing library!

Roy-05 avatar Feb 26 '21 15:02 Roy-05