Prepare colors to be exported.
       Flatten dicts and convert colors to util.Color()
342850
def flatten_colors(colors):
    """"""
    all_colors = {"wallpaper": colors["wallpaper"],
                  "alpha": colors["alpha"],
                  **colors["special"],
                  **colors["colors"]}
    return {k: util.Color(v) for k, v in all_colors.items()}
738533
def color_format():
    
    str_format = BASE_COLOR_FORMAT if supports_color() else BASE_FORMAT
    color_format = color_message(str_format)
    return ColoredFormatter(color_format)
574044
def derivative_colors(colors):
    """"""
    return set([('on_' + c) for c in colors] +
               [('bright_' + c) for c in colors] +
               [('on_bright_' + c) for c in colors])
890559
def color_map_data(self, data: numpy.ndarray) -> None:
        
        self.__color_map_data = data
        self.update()
103266
def calculate_colors(self, values):
        """"""
        # set domain if it is not set
        _flattenedList = list(flatten(values))
        if not self.is_domain_set:
            self.set_domain(_flattenedList)

        _flattenedColors = range(len(_flattenedList))
        for count, value in enumerate(_flattenedList):
            _flattenedColors[count] = self.calculate_color(value)

        return unflatten(values, iter(_flattenedColors))
405199
def color_to_rgb(color):
        
        if isinstance(color, tuple):
            return color
        if color.startswith('#'):
            try:
                return webcolors.hex_to_rgb(color)
            except ValueError:
                raise InvalidColor(color)

        try:
            return webcolors.name_to_rgb(color)
        except ValueError:
            raise InvalidColor(color)
642640
def saturate_colors(colors, amount):
    """"""
    if amount and float(amount) <= 1.0:
        for i, _ in enumerate(colors):
            if i not in [0, 7, 8, 15]:
                colors[i] = util.saturate_color(colors[i], float(amount))

    return colors
522187
def _colorize(self, msg, color=None, encode=False):
        
        
        # Valid colors
        colors = {
            'red':    '31',
            'green':  '32',
            'yellow': '33'
        }
        
        # No color specified or unsupported color
        if not color or not color in colors:
            return msg
        
        # The colorized string
        if encode:
            return u'\x1b[1;{}m{}\x1b[0m'.format(colors[color], msg)
        return '\x1b[1;{}m{}\x1b[0m'.format(colors[color], msg)
938690
function transformColor(string) {
  return parser(string).walk(function(node) {
    if (node.type !== "function" || node.value !== "color") {
      return
    }

    node.value = colorFn.convert(parser.stringify(node))
    node.type = "word"
  }).toString()
}
474884
function colorLines(name, str) {
  return str
    .split('\n')
    .map(function(str) {
      return color(name, str);
    })
    .join('\n');
}
980883
def _create_ansi_color_dict(color_cls):
    "  "
    return {
        'ansidefault':   color_cls.BLACK,
        'ansiblack':     color_cls.BLACK,
        'ansidarkgray':  color_cls.BLACK | color_cls.INTENSITY,
        'ansilightgray': color_cls.GRAY,
        'ansiwhite':     color_cls.GRAY | color_cls.INTENSITY,
        
        # Low intensity.
        'ansidarkred':     color_cls.RED,
        'ansidarkgreen':   color_cls.GREEN,
        'ansibrown':       color_cls.YELLOW,
        'ansidarkblue':    color_cls.BLUE,
        'ansipurple':      color_cls.MAGENTA,
        'ansiteal':        color_cls.CYAN,

        # High intensity.
        'ansired':        color_cls.RED | color_cls.INTENSITY,
        'ansigreen':      color_cls.GREEN | color_cls.INTENSITY,
        'ansiyellow':     color_cls.YELLOW | color_cls.INTENSITY,
        'ansiblue':       color_cls.BLUE | color_cls.INTENSITY,
        'ansifuchsia':    color_cls.MAGENTA | color_cls.INTENSITY,
        'ansiturquoise':  color_cls.CYAN | color_cls.INTENSITY,
    }
1152415
def color_string(color, string):
    
    if not color_available:
        return string

    return color + string + colorama.Fore.RESET
144889
function generateInspectStyle(originalMapStyle, coloredLayers, opts) {
  opts = Object.assign({
    backgroundColor: '#fff'
  }, opts);

  var backgroundLayer = {
    'id': 'background',
    'type': 'background',
    'paint': {
      'background-color': opts.backgroundColor
    }
  };

  var sources = {};
  Object.keys(originalMapStyle.sources).forEach(function (sourceId) {
    var source = originalMapStyle.sources[sourceId];
    if (source.type === 'vector' || source.type === 'geojson') {
      sources[sourceId] = source;
    }
  });

  return Object.assign(originalMapStyle, {
    layers: [backgroundLayer].concat(coloredLayers),
    soources: sources
  });
}
1341048
def to_color(self):
        
        color_data = np.repeat(self.data[:,:,np.newaxis], 3, axis=2)
        return ColorImage(color_data, self._frame)
332761
def colorize(string, color, *args, **kwargs):
    
    string = string.format(*args, **kwargs)
    return color + string + colorama.Fore.RESET
731632
def colorize(target, color, use_escape=True):
    ''' '''
    def escape(code):
        ''' Escape character '''
        return '\001%s\002' % code
    if color == 'purple':
        color_code = '\033[95m'
    elif color == 'cyan':
        color_code = '\033[96m'
    elif color == 'darkcyan':
        color_code = '\033[36m'
    elif color == 'blue':
        color_code = '\033[93m'
    elif color == 'green':
        color_code = '\033[92m'
    elif color == 'yellow':
        color_code = '\033[93m'
    elif color == 'red':
        color_code = '\033[91m'
    elif color == 'white':
        color_code = '\033[37m'
    elif color == 'bold':
        color_code = '\033[1m'
    elif color == 'underline':
        color_code = '\033[4m'
    else:
        color_code = ''
    if use_escape:
        return escape(color_code) + target + escape('\033[0m')
    else:
        return color_code + target + '\033[m'
354137
def ChargeColorMapping(maptype='jet', reverse=False):
    """"""

    pos_color = '#FF0000'
    neg_color = '#0000FF'
    neut_color = '#000000'

    mapping_d = {'A':neut_color,'R':pos_color,'N':neut_color,\
                 'D':neg_color,'C':neut_color,'Q':neut_color,\
                 'E':neg_color,'G':neut_color,'H':pos_color,\
                 'I':neut_color,'L':neut_color,'K':pos_color,\
                 'M':neut_color,'F':neut_color,'P':neut_color,\
                 'S':neut_color,'T':neut_color,'W':neut_color,\
                 'Y':neut_color,'V':neut_color}

    return (None, mapping_d, None)