© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
4 replies
Jay

✅ 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
#8F8C7E00
should resolve to
#FFFFFF
#FFFFFF
(Because the first hex is completely transparent as the last two digits are
00
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!
Color-Flattening-Examples.png
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...
How can I convert/flatten an 8-Digit Hex color (Alpha) to a 6-Digit...
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Hex color converter breaks on 3-digit and 4-digit values
C#CC# / help
2y ago
Cant convert HEX
C#CC# / help
4y ago
❔ How to convert a hex string to a Span<byte>?
C#CC# / help
3y ago
✅ How can i convert a character to an in?
C#CC# / help
3y ago