Backported the color setting modifications (Issue #22) from the 8.0 branch to the 2.2 branch and added the modifications related to issue #19