I am trying to determine colors for my site's themes. A great way I've found to do so is to take a main 6-digit hex color and simply add opacity on to the end of the hex code to get a complimentary color. The problem I'm having is that any time the secondary (the 8-digit hex code) color is to be on top of the main color you can't see it. Is there any way in css or php to convert an 8-digit hex code to it's equivalent color in a normal 6-digit hex code.
For example, my main color and secondary colors are as follows:
#053d06
#053d0614
I could go into a color picker and grab the secondary color and manually code it that way, but I'm trying to do it programmatically. I have tried clemblanco's rgba2hex/hex2rgba code, but that seems to just translate it back to the main color instead of the equivalent secondary color. Any help is appreciated! Thank you.
ETA: More directly I want a hex color that is the same color as the 8-digit code put over a white background. Thank you.