✅ How can I convert/flatten an 8-Digit Hex color (Alpha) to a 6-Digit Hex color (Assuming white BG)
Does anyone here know how to convert an 8-Digit HEX color code to a 6-Digit HEX color code (Assuming the background color is white)?
For instance
#8F8C7E00
should resolve to #FFFFFF
(Because the first hex is completely transparent as the last two digits are 00
.)
I've attached an image that elaborates.
Also have a stackoverflow post here that goes into more detail: https://stackoverflow.com/questions/78044876/how-can-i-convert-flatten-an-8-digit-hex-color-alpha-to-a-6-digit-hex-color-th
Any help at all would be extremely, extremely, appreciated!Stack Overflow
How can I convert/flatten an 8-Digit Hex color (Alpha) to a 6-Digit...
I've googled everywhere and can't find any resource or page that goes in to how to accomplish this. Most results just work with rgba() etc.
What I want exactly: To convert a 8-Digit hex with transp...
3 Replies
You have the algorithm right there
https://stackoverflow.com/a/78044915
Yep got it, thanks!
You linked it, lol. Don't thank me