The parties never switched. The Democrats just started pandering to the minorities they've been fighting against the entire time because they were losing a lot of votes.
Republicans freed the slaves. Republicans ended segregation.
Democrats just keep promising change that never comes.