Why do many of the flags of African countries have similar colors?

Ethiopia was the only sub-Saharan African country not to be colonized. Since the 19th century its flag has the colors green, yellow, and red. When Ghana became independent, it was inspired by Ethiopia’s resistance to colonization, and took those colors for its own flag. Subsequent African countries used the same colors, as a sign of unity with the other African countries.