Segregation was mandated by law so they had to separate themselves from white people, however many willingly did because they wanted to feel safe with people in their own community.
to stop treating people unfairly and no matter who you are and what you look like you should be treated the same and you could make a law that punishes discriminators like a fine