You're looking through different hex codes, and having trouble telling the difference between  #000001  and  #100000 

We need a way to tell which is red, and which is blue!

That's where you create ```hex_color()```!

It should read an RGB input, and return whichever value (red, blue, or green) is of greatest concentration!

But, if multiple colors are of equal concentration, you should return their mix!

```python
red + blue = magenta

green + red = yellow

blue + green = cyan

red + blue + green = white
```

One last thing, if the string given is empty, or has all 0's, return black!

Examples:
```python
hex_color('087 255 054') == 'green'
hex_color('181 181 170') == 'yellow'
hex_color('000 000 000') == 'black'
hex_color('001 001 001') == 'white'
```

Difficulty: EASY
Tags: Fundamentals

Starter code:
def hex_color(codes):
	

Solutions:
colors = {(1, 0, 0): 'red', (0, 1, 0): 'green', (0, 0, 1): 'blue', (1, 0, 1): 'magenta', (1, 1, 0): 'yellow', (0, 1, 1): 'cyan', (1, 1, 1): 'white'}

def hex_color(codes):
	codes = codes or '0 0 0'
	items = [int(c) for c in codes.split()]
	m = max(items)
	return colors[tuple((i == m for i in items))] if m else 'black'


_COLORS = ['black', 'blue', 'green', 'cyan', 'red', 'magenta', 'yellow', 'white']

def hex_color(codes):
	colors = [int(color) for color in (codes or '0 0 0').split()]
	index = int(''.join(('1' if color and color == max(colors) else '0' for color in colors)), 2)
	return _COLORS[index]


color_map = {0: 'black', 1: 'red', 2: 'green', 3: 'yellow', 4: 'blue', 5: 'magenta', 6: 'cyan', 7: 'white'}

def hex_color(codes):
	(values, brightest, color, i) = ([], 0, 0, 0)
	if not codes:
		codes = '000 000 000'
	for code in codes.split(' '):
		value = int(code)
		if value > brightest:
			brightest = value
			color = 2 ** i
		elif value == brightest != 0:
			color += 2 ** i
		i += 1
	return color_map[color]


def hex_color(codes):
	if codes in ('', '000 000 000'):
		return 'black'
	(r, g, b) = (int(color) for color in codes.split())
	if r == g == b:
		return 'white'
	if r > g and r > b:
		return 'red'
	if g > r and g > b:
		return 'green'
	if b > r and b > g:
		return 'blue'
	if r == b:
		return 'magenta'
	if g == r:
		return 'yellow'
	if b == g:
		return 'cyan'


colors = {1: 'red', 2: 'green', 4: 'blue', 3: 'yellow', 5: 'magenta', 6: 'cyan', 7: 'white'}

def hex_color(codes):
	codes = [int(code) for code in codes.split()]
	most = max(codes, default=0)
	return colors[sum((2 ** i for (i, code) in enumerate(codes) if code == most))] if most else 'black'


def hex_color(s):
	(a, b, c) = [int(x) for x in s.split() or [0, 0, 0]]
	for (n, r) in [(0, 'black'), (c, 'white')]:
		if a == b == c == n:
			return r
	m = max(a, b, c)
	if m == a == b:
		return 'yellow'
	if m == a == c:
		return 'magenta'
	if m == b == c:
		return 'cyan'
	return 'red' if m == a else 'green' if m == b else 'blue'


def hex_color(codes):
	if codes == '':
		return 'black'
	(r, g, b) = map(int, codes.split(' '))
	if 0 == r == g == b:
		return 'black'
	if r == g == b:
		return 'white'
	if r > g and r > b:
		return 'red'
	if g > r and g > b:
		return 'green'
	if b > g and b > r:
		return 'blue'
	if r > g and r == b:
		return 'magenta'
	if r > b and r == g:
		return 'yellow'
	if b > r and b == g:
		return 'cyan'


def hex_color(codes):
	try:
		(r, g, b) = (int(a) for a in codes.split())
	except ValueError:
		return 'black'
	if r == g == b:
		return 'black' if r == 0 else 'white'
	if r > g and r > b:
		return 'red'
	elif g > r and g > b:
		return 'green'
	elif b > r and b > g:
		return 'blue'
	elif r == g:
		return 'yellow'
	elif g == b:
		return 'cyan'
	elif b == r:
		return 'magenta'


def hex_color(codes):
	if codes == '':
		return 'black'
	(r_, g_, b_) = map(int, codes.split())
	(r, g, b) = (max(r_, g_, b_) == r_, max(r_, g_, b_) == g_, max(r_, g_, b_) == b_)
	if (r_, g_, b_) == (0, 0, 0):
		return 'black'
	elif r and g and b:
		return 'white'
	elif r and g:
		return 'yellow'
	elif r and b:
		return 'magenta'
	elif g and b:
		return 'cyan'
	elif r:
		return 'red'
	elif g:
		return 'green'
	elif b:
		return 'blue'


def hex_color(codes):
	(r, g, b) = [int(hex) for hex in (codes.split(' ') if codes != '' else '000')]
	m = max(r, g, b)
	return ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'][(m > 0) * (1 * (r == m) + 2 * (g == m) + 4 * (b == m))]