void applyColorScale(Mesh mesh) {
		// ONLY the current mesh now. Previous was just too weird.
		if (colorPhase == 0 && dataType != SURFACE_ATOMICORBITAL)
			colorPhase = 1;
		int vertexCount = mesh.vertexCount;
		short[] colixes = mesh.vertexColixes;
		colorFractionBase = defaultColorFractionBase;
		colorFractionRange = defaultColorFractionRange;
		setMapRanges();
		float min = mappedDataMin;
		float max = mappedDataMax;
		Logger.info("full mapped data range: " + min + " to " + max);
		if (isBicolorMap && thePlane == null || colorBySign)
			Logger.info("coloring by sign");
		else if (colorByPhase)
			Logger.info("coloring by phase: " + colorPhases[colorPhase]);
		else Logger.info("coloring red to blue over range: " + valueMappedToRed + " to " + valueMappedToBlue);
		if (colixes == null)
			mesh.vertexColixes = colixes = new short[vertexCount];
		String list = "";
		String list1 = "";
		int incr = (mesh.hasGridPoints && mesh.jvxlPlane == null ? 3 : 1);
		if (jvxlDataIsPrecisionColor || isContoured)
			jvxlWritePrecisionColor = true;
		for (int i = 0; i < vertexCount; i += incr) {
			float value = getVertexColorValue(mesh, i);
			if (mesh.firstViewableVertex == 0 || i < mesh.firstViewableVertex) {
				char ch;
				if (jvxlWritePrecisionColor) {
					ch = jvxlValueAsCharacter2(value, min, max, colorFractionBase, colorFractionRange);
					list1 += remainder;
					if (logCompression)
						Logger.debug("setcolor precision "
								+ value
								+ " as '"
								+ ch
								+ jvxlValueFromCharacter2(ch, remainder, min, max, colorFractionBase,
										colorFractionRange) + "'/remainder=" + remainder + " ");
				}
				else {
					// isColorReversed
					ch = jvxlValueAsCharacter(value, valueMappedToRed, valueMappedToBlue, colorFractionBase,
							colorFractionRange);
					if (logCompression)
						Logger.info("setcolor noprecision " + value + " as " + ch);
				}
				list += ch;
			}
		}
		mesh.isJvxlPrecisionColor = jvxlWritePrecisionColor;
		mesh.jvxlColorData = (colorByPhase && !isBicolorMap && !colorBySign ? "" : list + list1 + "\n");
		if (logMessages)
			Logger.info("color data: " + mesh.jvxlColorData);
	}