Determines the hex color for a layer.
    :parameters:
        - layer_type : string
            Class name of the layer
    :returns:
        - color : string containing a hex color for filling block.
160315
def get_hex_color(layer_type):
    
    COLORS = ['#4A88B3', '#98C1DE', '#6CA2C8', '#3173A2', '#17649B',
              '#FFBB60', '#FFDAA9', '#FFC981', '#FCAC41', '#F29416',
              '#C54AAA', '#E698D4', '#D56CBE', '#B72F99', '#B0108D',
              '#75DF54', '#B3F1A0', '#91E875', '#5DD637', '#3FCD12']

    hashed = int(hash(layer_type)) % 5

    if "conv" in layer_type.lower():
        return COLORS[:5][hashed]
    if layer_type in lasagne.layers.pool.__all__:
        return COLORS[5:10][hashed]
    if layer_type in lasagne.layers.recurrent.__all__:
        return COLORS[10:15][hashed]
    else:
        return COLORS[15:20][hashed]
624724
def hex_color(self, safe: bool = False) -> str:
        
        if safe:
            return self.random.choice(SAFE_COLORS)

        return '#{:06x}'.format(
            self.random.randint(0x000000, 0xffffff))
137263
def hls(self):
        
        r, g, b = self.color
        hls = colorsys.rgb_to_hls(r, g, b)
        hls = (int(round(hls[0] * 360)), hls[1], hls[2])
        return self._append_alpha_if_necessary(hls)
764682
def color(self, color):
        
        if color is None:
            color = 0xFFFFFFFF

        idc.SetColor(self.ea, idc.CIC_ITEM, color)
45789
def hexdump(self, lfilter=None):
        """"""  # noqa: E501
        for i, res in enumerate(self.res):
            p = self._elt2pkt(res)
            if lfilter is not None and not lfilter(p):
                continue
            print("%s %s %s" % (conf.color_theme.id(i, fmt="%04i"),
                                p.sprintf("%.time%"),
                                self._elt2sum(res)))
            hexdump(p)
47810
def as_hex(self):
        
        hex = [mpl.colors.rgb2hex(rgb) for rgb in self]
        return ColorPalette(hex)
348026
def get_layer(self, class_: Type[L], became: bool=True) -> L:
        

        try:
            return self._index[class_][0]
        except KeyError:
            if became:
                return self._transformed[class_][0]
            else:
                raise
881117
def _convert_tuple_color_to_hex(cls, color):
        
        if isinstance(color, tuple):
            return '#{:02x}{:02x}{:02x}'.format(*color)
        elif isinstance(color, str):
            if not color.startswith('#'):
                return '#{color_hex}'.format(color_hex=color)
            else:
                return color
        else:
            return '#000'
683768
def colour_rgb(self):
        """"""
        hexvalue = self.status()[self.DPS][self.DPS_INDEX_COLOUR]
        return BulbDevice._hexvalue_to_rgb(hexvalue)
511915
def opacity( self ):
        
        if self.isIsolateHidden():
            return 0.1
        
        opacity = super(XNode, self).opacity()
        layer = self.layer()
        if layer:
            return layer.opacity() * opacity
        
        return opacity
118366
def get_colour(self, val, colformat='hex'):
		
		try:
			# Sanity checks
			val = re.sub("[^0-9\.]", "", str(val))
			if val == '':
				val = self.minval
			val = float(val)
			val = max(val, self.minval)
			val = min(val, self.maxval)

			domain_nums = list( np.linspace(self.minval, self.maxval, len(self.colours)) )
			my_scale = spectra.scale(self.colours).domain(domain_nums)

			# Weird, I know. I ported this from the original JavaScript for continuity
			# Seems to work better than adjusting brightness / saturation / luminosity
			rgb_converter = lambda x: max(0, min(1, 1+((x-1)*0.3)))
			thecolour = spectra.rgb( *[rgb_converter(v) for v in my_scale(val).rgb] )

			return thecolour.hexcode

		except:
			# Shouldn't crash all of MultiQC just for colours
			return ''
735124
def color_hex(self):
        """"""
        def clamp(x):
            return max(0, min(int(x), 255))

        r, g, b = np.trunc(self.color_rgb * 255)
        return "#{0:02x}{1:02x}{2:02x}".format(clamp(r), clamp(g), clamp(b))
1087305
def rgb(self):
        # type: () -> bytes
        

        if not self.__rgb:
            rgb = bytearray(self.height * self.width * 3)
            raw = self.raw
            rgb[0::3] = raw[2::4]
            rgb[1::3] = raw[1::4]
            rgb[2::3] = raw[0::4]
            self.__rgb = bytes(rgb)

        return self.__rgb
368924
def backColor(self, bc=None):
        
        backProp = self.GetBackfaceProperty()

        if bc is None:
            if backProp:
                return backProp.GetDiffuseColor()
            return None

        if self.GetProperty().GetOpacity() < 1:
            colors.printc("~noentry backColor(): only active for alpha=1", c="y")
            return self

        if not backProp:
            backProp = vtk.vtkProperty()

        backProp.SetDiffuseColor(colors.getColor(bc))
        backProp.SetOpacity(self.GetProperty().GetOpacity())
        self.SetBackfaceProperty(backProp)
        self.GetMapper().ScalarVisibilityOff()
        return self
455964
private String colorType(SchemaConcept schemaConcept) {
        if(colorize) {
            return ANSI.color(label(schemaConcept.label()), ANSI.PURPLE);
        } else {
            return label(schemaConcept.label());
        }
    }
1015798
def as_rgb(self):
        
        rgb = [mpl.colors.colorConverter.to_rgb(hex) for hex in self]
        return ColorPalette(rgb)
903511
def color(color_code) # :nodoc:
      if color_code and color_code =~ /^#[0-9a-fA-F]{6}$/
        # Convert a HTML style #RRGGBB color.
        color_code.sub(/^#/, '').upcase
      else
        index = Format.color(color_code)
        raise "Unknown color '#{color_code}' used in chart formatting." unless index
        palette_color(index)
      end
    end