Python webcolors.rgb_to_name() Examples

The following are 5 code examples of webcolors.rgb_to_name(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module webcolors , or try the search function .
Example #1
Source File: __main__.py    From flux_led with GNU Lesser General Public License v3.0 5 votes vote down vote up
def color_tuple_to_string(rgb):
        # try to convert to an english name
        try:
            return webcolors.rgb_to_name(rgb)
        except Exception:
            #print e
            pass
        return str(rgb) 
Example #2
Source File: color.py    From ssbio with MIT License 5 votes vote down vote up
def get_colour_name(requested_colour):
    try:
        closest_name = actual_name = webcolors.rgb_to_name(requested_colour)
    except ValueError:
        closest_name = closest_colour(requested_colour)
        actual_name = None
    return actual_name, closest_name 
Example #3
Source File: colors.py    From ImageSoup with MIT License 5 votes vote down vote up
def get_color_name(requested_color):
    try:
        color_name = webcolors.rgb_to_name(requested_color)
    except ValueError:
        color_name = closest_color(requested_color)
    return color_name 
Example #4
Source File: hue_ui.py    From hue-plus with GNU General Public License v3.0 5 votes vote down vote up
def get_colour_name(requested_colour):
    try:
        closest_name = actual_name = webcolors.rgb_to_name(requested_colour)
    except ValueError:
        closest_name = closest_colour(requested_colour)
        actual_name = None
    return actual_name, closest_name 
Example #5
Source File: flux_led.py    From homebridge-magichome with MIT License 5 votes vote down vote up
def color_tuple_to_string(rgb):
		# try to convert to an english name
		try:
			return webcolors.rgb_to_name(rgb)
		except Exception as e:
			#print e
			pass
		return str(rgb)