Instead merge continuous regions of colored output. This way different shell implementations shouldn't make a difference.