Flatten if/else block to reduce code duplication. Use tertiary for colou...

...r setting.