code: def draw_dithered_color(cb, x, y, palette, dither, n, n_max, crosshairs_coord=None):
      
      i = n * (len(palette) - 1) / n_max
      c1 = palette[int(math.floor(i))]
      c2 = palette[int(math.ceil(i))]
      value = i - int(math.floor(i))
  
      symbol = dither_symbol(value, dither)
  
      if crosshairs_coord is not None:
          old_symbol = symbol
          symbol, crosshairs = get_crosshairs_symbol(x, y, old_symbol, crosshairs_coord)
          if crosshairs:
              sorted_palette = sort_palette(palette)
              if old_symbol == DITHER_TYPES[dither][1][0]:
                  c2 = c1
              sorted_index = sorted_palette.index(c2)
              if sorted_index > len(sorted_palette) // 2:
                  c1 = sorted_palette[0]
              else:
                  c1 = sorted_palette[-1]
  
      cb.put(x, y, symbol, c1(), c2())
docs: Draws a dithered color block on the terminal, given a palette.
      :type cb: cursebox.CurseBox