We use X-ray micro-tomography data to investigate and develop a novel methodology for characterizing wettability in porous media. The proposed formulation is based on the geometrical and topological arguments that constrains the morphological state of immiscible fluids. The constraint is based on the acclaimed Gauss-Bonnet theorem, which describes all possible combinations of contact angles and interfacial curvatures that can exist. The significance of our proposed method is that it provides a transparent link between pore scale contact angle measurement and continuum scale wettability index.