Theory for the equilibrium contact angle between a gas, a liquid and a solid