Fixed hexToShorthand function which will convert hex colors into their short hand equivalent if possible