Migrate homepage.css and conditional isInATheme

Also refactored code to css.py
This refs affinitic #5741