Move common code to xloadcolor