protected String shorthandHexColors(String line) {
		// shorthand hex codes
		int indexOfhash = line.indexOf("#");
		if (line.length() >= 7 && indexOfhash != -1 && indexOfhash + 7 <= line.length()) {
			// should of picked up colours and maybe some #id lines with this if statement, now we make sure to only affect colours
			String colorHex = line.substring(indexOfhash + 1, indexOfhash + 7);
			if (colorHex.matches("[a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]")) {
				// this regex will match a 6 digit hex number, e.g. FFFFFF ffffff 000000 121212 73f3ea

				colorHex = colorHex.toLowerCase(); // lower case everything in case of colours like fFfFfF or aAfFdD

				// Now we find pairs of letters or numbers in the string
				String shortHand = "";
				String pairs[] = new String[colorHex.length() / 2];
				pairs[0] = colorHex.substring(0, 2);
				pairs[1] = colorHex.substring(2, 4);
				pairs[2] = colorHex.substring(4, 6);
				for (String s : pairs) {
					if (s.charAt(0) == s.charAt(1)) {
						shortHand += s.charAt(0);
					}
				}

				if (shortHand.length() == 3) {
					// make sure the shorthand version is valid

					// now we need to replace that part of the line
					line = line.replace(line.substring(indexOfhash + 1, indexOfhash + 7), shortHand);
//						System.out.println(colorHex + " = " + shortHand);
				}
			}

		}
		return line;
	}