We're supposed to generate separate CSS files for each theme.   You are generating one file for everything.  The switchTheme() function you have below is also non-standard.