text_extensions_for_pandas/jupyter/widget/span.py
def _get_span_color(
    color_mode: str, stack_data, tag: str, color_map: dict, color_index: int
) -> tuple:
    """Gets the appropriate color for a span and returns (the color, the updated color map, the updated color index)"""
    if color_mode == "ROW":
        return (
            f"#{_COLOR_PALETTE[stack_data[1] % len(_COLOR_PALETTE)]}",
            color_map,
            color_index,
        )
    elif color_mode == "TAG":
        if tag in color_map:
            return color_map[tag], color_map, color_index
        else:
            color_map.update(
                {tag: f"#{_COLOR_PALETTE[color_index % len(_COLOR_PALETTE)]}"}
            )
            color_index += 1
            return color_map[tag], color_map, color_index
Gets the appropriate color for a span and returns (the color, the updated color map, the updated color index)
Gets the appropriate color for a span and returns (the color, the updated color map, the updated color index)
Gets the appropriate color for a span and returns ( the color the updated color map the updated color index )
def _get_span_color(
    color_mode: str, stack_data, tag: str, color_map: dict, color_index: int
) -> tuple:
    if color_mode == "ROW":
        return (
            f"#{_COLOR_PALETTE[stack_data[1] % len(_COLOR_PALETTE)]}",
            color_map,
            color_index,
        )
    elif color_mode == "TAG":
        if tag in color_map:
            return color_map[tag], color_map, color_index
        else:
            color_map.update(
                {tag: f"#{_COLOR_PALETTE[color_index % len(_COLOR_PALETTE)]}"}
            )
            color_index += 1
            return color_map[tag], color_map, color_index
def _get_span_color ( color_mode : str , stack_data , tag : str , color_map : dict , color_index : int ) -> tuple : if color_mode == "ROW" : return ( f"#{_COLOR_PALETTE[stack_data[1] % len(_COLOR_PALETTE)]}" , color_map , color_index , ) elif color_mode == "TAG" : if tag in color_map : return color_map [ tag ] , color_map , color_index else : color_map . update ( { tag : f"#{_COLOR_PALETTE[color_index % len(_COLOR_PALETTE)]}" } ) color_index += 1 return color_map [ tag ] , color_map , color_index
Gets the appropriate color for a span and returns (the color, the updated color map, the updated color index)
Gets the appropriate color for a span and returns ( the color the updated color map the updated color index )
"""Gets the appropriate color for a span and returns (the color, the updated color map, the updated color index)"""
color_mode
str
stack_data
tag
str
color_map
dict
color_index
int