Move virtualenv segment into its own function.

Change background color to slate blue to match theme.