Whether it is colonial or not does not matter for legitimacy. A blanket rejection of treaties on the basis of being colonial and unfair would invalidate all border agreements between former colonial countries.
Of course, the international community can condemn treaties and push for decolonialization, but in most cases this is foiled by the refusal of the colonial power to give up the claim. Examples: Falkland islands, West Sahara, Goa (reconquered by India using military force).
In many cases, it is advantegeous for both parties to seek a peaceful decoloniazation treaty, which becomes a part of international law and formal basis for the future claim on the decolonized territory.
It has a huge impact in practice. The international community will look much more favourably on a country that violates a colonial treaty with its former Metropolis than with any other country.
In practice, colonial era treaties are less legitimate. No one except the parties directly materially affected care.
Of course, the international community can condemn treaties and push for decolonialization, but in most cases this is foiled by the refusal of the colonial power to give up the claim. Examples: Falkland islands, West Sahara, Goa (reconquered by India using military force).
In many cases, it is advantegeous for both parties to seek a peaceful decoloniazation treaty, which becomes a part of international law and formal basis for the future claim on the decolonized territory.