def colorToTagIndex(col):
	"""Convert an MColor value to a tag index."""
	r = hex(int(round(col.r*255.0)))[::-1]
	while len(r) < 4: r += '0'
	r = r[::-1]
	g = hex(int(round(col.g*255.0)))[::-1]
	while len(g) < 4: g += '0'
	g = g[::-1]
	return int('0x%s%s'%(g[g.find('x')+1::], r[r.find('x')+1::]), 16)