issue #3945 Refactor setColor and setOpacity