code: def get_color_map_list(num_classes, custom_color=None):
      """
      Returns the color map for visualizing the segmentation mask,
      which can support arbitrary number of classes.
  
      Args:
          num_classes (int): Number of classes.
          custom_color (list, optional): Save images with a custom color map. Default: None, use paddleseg's default color map.
  
      Returns:
          (list). The color map.
      """
  
      num_classes += 1
      color_map = num_classes * [0, 0, 0]
      for i in range(0, num_classes):
          j = 0
          lab = i
          while lab:
              color_map[i * 3] |= ((lab >> 0) & 1) << (7 - j)
              color_map[i * 3 + 1] |= ((lab >> 1) & 1) << (7 - j)
              color_map[i * 3 + 2] |= ((lab >> 2) & 1) << (7 - j)
              j += 1
              lab >>= 3
      color_map = color_map[3:]
  
      if custom_color:
          color_map[: len(custom_color)] = custom_color
      return color_map
  
file_path: PaddleSeg/contrib/MedicalSeg/medicalseg/utils/visualize.py
imports: import os
  import cv2
  import numpy
  from PIL import Image
label_desc: Use image node_id 4 for calling a global function with example usage: get_color_map_list(num_classes, custom_color) and returns: color_map