INNER CODE UNIT · Python

hex_to_rgb_color_list

stefmolin/Hands-On-Data-Analysis-with-Pandas-2nd-edition · ch_06/color_utils.py:10

def hex_to_rgb_color_list(colors):
    """
    Take color or list of hex code colors and convert them
    to RGB colors in the range [0,1].

    Parameters:
        - colors: Color or list of color strings of the format
                  '#FFF' or '#FFFFFF'

    Returns:
        The color or list of colors in RGB representation.
    """
    if isinstance(colors, str):
        colors = [colors]

    for i, color in enumerate(
        [color.replace('#', '') for color in colors]
    ):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…