Improve colour code handling in console mode