A uint8 array with the shape (height, width, 3).

        You can change the consoles background colors by using this array.

        Index this array with ``console.bg[i, j, channel]  # order='C'`` or
        ``console.bg[x, y, channel]  # order='F'``.
963538
def bg(self) -> np.array:
        
        bg = self._tiles["bg"][..., :3]
        if self._order == "F":
            bg = bg.transpose(1, 0, 2)
        return bg
418559
def gen_colors(img):
    """"""
    palette = Haishoku.getPalette(img)
    return [util.rgb_to_hex(col[1]) for col in palette]
44148
def standard_settings(self):
        """"""
        cmd.set('bg_rgb', [1.0, 1.0, 1.0])  # White background
        cmd.set('depth_cue', 0)  # Turn off depth cueing (no fog)
        cmd.set('cartoon_side_chain_helper', 1)  # Improve combined visualization of sticks and cartoon
        cmd.set('cartoon_fancy_helices', 1)  # Nicer visualization of helices (using tapered ends)
        cmd.set('transparency_mode', 1)  # Turn on multilayer transparency
        cmd.set('dash_radius', 0.05)
        self.set_custom_colorset()
267276
function (str) {
            var values, r, g, b, a = 1;
            if ((str.length === 4 || str.length === 7) && str.substr(0, 1) === '#') {
                values = str.match(hexRe);
                if (values) {
                    r = parseHex(values[1]);
                    g = parseHex(values[2]);
                    b = parseHex(values[3]);
                    if (str.length === 4) {
                        r = paddingHex(r);
                        g = paddingHex(g);
                        b = paddingHex(b);
                    }
                }
            } else {
                values = str.match(rgbaRe);
                if (values) {
                    r = parseInt(values[1], 10);
                    g = parseInt(values[2], 10);
                    b = parseInt(values[3], 10);
                    a = parseFloat(values[4]) || 1;
                }
            }
            return typeof r === 'undefined' ? undefined : new Color({
                r: r,
                g: g,
                b: b,
                a: a
            });
        }
772582
function(rgb){
            var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            var hex = (parts[1]<<16|parts[2]<<8|parts[3]).toString(16);
            return "#"+Array(6-hex.length).concat([hex]).toString().replace(/,/g, 0);
        }
1087762
def console_set_background_flag(con: tcod.console.Console, flag: int) -> None:
    
    lib.TCOD_console_set_background_flag(_console(con), flag)
251930
def set_pixel(framebuf, x, y, color):
        """"""
        index = (y >> 3) * framebuf.stride + x
        offset = y & 0x07
        framebuf.buf[index] = (framebuf.buf[index] & ~(0x01 << offset)) | ((color != 0) << offset)
455950
def console_get_default_background(con: tcod.console.Console) -> Color:
    
    return Color._new_from_cdata(
        lib.TCOD_console_get_default_background(_console(con))
    )
1053559
def set_pixel(x,y,color)

      index = (y*@width + x)
      pointindex = index*3
      @array[pointindex+2] = color.r.chr
      @array[pointindex+1] = color.g.chr
      @array[pointindex] = color.b.chr

      if color.a != 255 then
        @alpha = 255.chr*(@height * @width) unless @alpha
        @alpha[index] = color.a.chr
      end

      self
    end
106261
def configure_threecolor_image(self):
        
        order = {'red': 0, 'green': 1, 'blue': 2}
        self.image = np.zeros((self.shape[0], self.shape[1], 3))
        for color, var in self.multicolorvars.items():
            channel = var.get()  # determine which channel should be plotted as this color
            self.image[:, :, order[color]] = self.data[channel]

            # scale the image by the power
            self.image[:, :, order[color]] = np.power(self.image[:, :, order[color]],
                                                      self.multicolorpower[color].get())

            # adjust the percentile thresholds
            lower = np.nanpercentile(self.image[:, :, order[color]], self.multicolormin[color].get())
            upper = np.nanpercentile(self.image[:, :, order[color]], self.multicolormax[color].get())
            self.image[np.where(self.image[:, :, order[color]] < lower)] = lower
            self.image[np.where(self.image[:, :, order[color]] > upper)] = upper

        # image values must be between (0,1) so scale image
        for color, index in order.items():
            self.image[:, :, index] /= np.nanmax(self.image[:, :, index])
1302201
def write_color(self, text, attr=None):
        '''
        '''
        log(u'write_color("%s", %s)' % (text, attr))
        chunks = self.terminal_escape.split(text)
        log(u'chunks=%s' % repr(chunks))
        bg = self.savebg
        n = 0 # count the characters we actually write, omitting the escapes
        if attr is None:#use attribute from initial console
            attr = self.attr
        try:
            fg = self.trtable[(0x000f&attr)]
            bg = self.trtable[(0x00f0&attr)>>4]
        except TypeError:
            fg = attr
            
        for chunk in chunks:
            m = self.escape_parts.match(chunk)
            if m:
                log(m.group(1))
                attr = ansicolor.get(m.group(1), self.attr)
            n += len(chunk)
            System.Console.ForegroundColor = fg
            System.Console.BackgroundColor = bg
            System.Console.Write(chunk)
        return n
1012533
def console_get_char_foreground(
    con: tcod.console.Console, x: int, y: int
) -> Color:
    
    return Color._new_from_cdata(
        lib.TCOD_console_get_char_foreground(_console(con), x, y)
    )
275808
function initPalettes() {
	var i, j,
	    result = new Uint8Array( 0x100 );

	for ( i = 0; i < 4; i++ ) {
		for ( j = 0; j < 8; j += 2 ) {
			result[ i << j ] = i << 2; // shift by 2 places, so value can be easily ORed with color
		}
	}

	return result;
}
36244
function (x0, y0, width, height, c)
    {
        _c = c || _c
        const data = _c.getImageData(x0, y0, width, height)
        const bits = data.data

        const pixels = []
        for (let y = 0; y < height; y += _scale)
        {
            for (let x = 0; x < width; x += _scale)
            {
                const index = x * 4 + y * width * 4
                if (bits[index + 3] === 0)
                {
                    pixels.push(null)
                }
                else
                {
                    const color = Color.rgbToHex(bits[index], bits[index + 1], bits[index + 2])
                    pixels.push(parseInt(color, 16))
                }
            }
        }
        return pixels
    }
671782
def _init_setup_console_data(self, order: str = "C") -> None:
        """"""
        global _root_console
        self._key_color = None
        if self.console_c == ffi.NULL:
            _root_console = self
            self._console_data = lib.TCOD_ctx.root
        else:
            self._console_data = ffi.cast(
                "struct TCOD_Console*", self.console_c
            )

        self._tiles = np.frombuffer(
            ffi.buffer(self._console_data.tiles[0 : self.width * self.height]),
            dtype=self.DTYPE,
        ).reshape((self.height, self.width))

        self._order = tcod._internal.verify_order(order)
188753
function getPixelSetter() {
    var offset = 0;
    return function(colors, c) {
        colors[offset] = c.r;
        colors[offset + 1] = c.g;
        colors[offset + 2] = c.b;
        colors[offset + 3] = c.a;
        offset += 4;
    };
}
500236
def rgb(color,default=(0,0,0)):
    
    c = color.lower()
    if c[0:1] == '#' and len(c)==7:
        r,g,b = c[1:3], c[3:5], c[5:]
        r,g,b = [int(n, 16) for n in (r, g, b)]
        return (r,g,b)

    if c.find(' ')>-1:    c = c.replace(' ','')
    if c.find('gray')>-1: c = c.replace('gray','grey')
    if c in x11_colors.keys():  return x11_colors[c]
    return default