Fix stack overflow when formatting ColorMask

The old implementation of ColorMask relied on itself for formatting,
leading to an infinite recursive loop and eventual stack overflow.
I would prefer separate calls to `write!` than the allocation.