Skip to content

utility module

Utility module.

rgb_to_hex(color)

Helper function for converting RGB color to hex code

Parameters:

Name Type Description Default
color list

List of R,G,B value

required

Returns:

Type Description
str

Hex code for the RGB value

Source code in mygeopackage/utility.py
def rgb_to_hex(color):
    """Helper function for converting RGB color to hex code

    Args:
        color (list): List of R,G,B value

    Returns:
        str: Hex code for the RGB value
    """
    r,g,b = color
    #print('%02x%02x%02x' % (r,g,b))
    return '#%02x%02x%02x' % (r,g,b)

Last update: 2021-05-03