When you click "login" you're redirected to the Guest community. Therefore, the theme that is used for the login page is the theme of the Guest community.
However, if a user is going to the login page from another community, the theme and color schme should match the theme and color scheme from the previous page.
So if the theme and color scheme are not null, the ServicePreAction should use the existing values.