Adding hexadecimals to output one mixed color in code

Does anyone know how to add multiple hexadecimals that have different strengths together to output one solid color?

Trouble has arisen when I tried to add 7 hexadecimal colors to output one color, because the value was inaccurate and too long to be a hexadecimal code. My goal is to achieve the same effect as stacking slightly opaque tinted squares. I just don’t want to bog down the system by having stacks of 7 squares everywhere when I could just have 1 square everywhere. Each square has a different alpha to exert more color than other squares in the stack, but the overall alpha is exactly 100% for a solid color.

Thanks for the help.