Improve color serialization to reflect rgb/rgba rules.