Create the color tables for palette downgrade support,
        starting with the platform-specific 16 from the color tables module.
        Save as global state. :-/
433236
def build_color_tables(base=color_tables.vga_palette4):
    '''
        
    '''
    base = [] if base is None else base

    # make sure we have them before clearing
    table4 = _build_color_table(base, extended=False)
    if table4:
        color_table4.clear()
        color_table4.extend(table4)

    table8 = _build_color_table(base)
    if table8:
        color_table8.clear()
        color_table8.extend(table8)
1030713
public void setGradationColor(GradationMode2D mode, Color color1, Color color2) {
        setGradation(true);
        if (startColor == null || endColor == null) {
            startColor = new RGBColor(0.0, 0.0, 0.0);
            endColor = new RGBColor(0.0, 0.0, 0.0);
        }
        startColor = color1;
        endColor = color2;
        this.mode = mode;
    }
92692
private static void buildYCCtoRGBtable() {
        if (ColorSpaces.DEBUG) {
            System.err.println("Building YCC conversion table");
        }

        for (int i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
            // i is the actual input pixel value, in the range 0..MAXJSAMPLE
            // The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE
            // Cr=>R value is nearest int to 1.40200 * x
            Cr_R_LUT[i] = (int) ((1.40200 * (1 << SCALEBITS) + 0.5) * x + ONE_HALF) >> SCALEBITS;
            // Cb=>B value is nearest int to 1.77200 * x
            Cb_B_LUT[i] = (int) ((1.77200 * (1 << SCALEBITS) + 0.5) * x + ONE_HALF) >> SCALEBITS;
            // Cr=>G value is scaled-up -0.71414 * x
            Cr_G_LUT[i] = -(int) (0.71414 * (1 << SCALEBITS) + 0.5) * x;
            // Cb=>G value is scaled-up -0.34414 * x
            // We also add in ONE_HALF so that need not do it in inner loop
            Cb_G_LUT[i] = -(int) ((0.34414) * (1 << SCALEBITS) + 0.5) * x + ONE_HALF;
        }
    }
1263000
def build_colormap(palette, dtype, info):
        """"""
        from trollimage.colormap import Colormap
        sqpalette = np.asanyarray(palette).squeeze() / 255.0
        if hasattr(palette, 'attrs') and 'palette_meanings' in palette.attrs:
            meanings = palette.attrs['palette_meanings']
            iterator = zip(meanings, sqpalette)
        else:
            iterator = enumerate(sqpalette[:-1])

        if dtype == np.dtype('uint8'):
            tups = [(val, tuple(tup))
                    for (val, tup) in iterator]
            colormap = Colormap(*tups)

        elif 'valid_range' in info:
            tups = [(val, tuple(tup))
                    for (val, tup) in iterator]
            colormap = Colormap(*tups)

            sf = info.get('scale_factor', np.array(1))
            colormap.set_range(
                *info['valid_range'] * sf + info.get('add_offset', 0))

        return colormap, sqpalette
181059
public static AcadColor[] initTable() {
		colors = new AcadColor[256];

		new AcadColor(0, 0, 0, 0, 0, 0, 0);
		
		new AcadColor(1, 1, 0, 0, 255, 0, 0);
		new AcadColor(2, 1, 1, 0, 255, 255, 0);
		new AcadColor(3, 0, 1, 0, 0, 255, 0);
		new AcadColor(4, 0, 1, 1, 0, 255, 255);
		new AcadColor(5, 0, 0, 1, 0, 0, 255);
		new AcadColor(6, 1, 0, 1, 255, 0, 255);
		new AcadColor(7, 0, 0, 0, 0, 0, 0);
		new AcadColor(8, 0, 0, 0, 0, 0, 0);
		new AcadColor(9, 0, 0, 0, 0, 0, 0);
		new AcadColor(10, 1, 0, 0, 255, 0, 0);
		new AcadColor(11, 1.0, 0.5, 0.5, 255.0, 127.5, 127.5);
		new AcadColor(12, 0.65, 0, 0, 165.75, 0, 0);
		new AcadColor(13, 0.65, 0.325, 0.325, 165.75, 82.875, 82.875);
		new AcadColor(14, 0.5, 0, 0, 127.5, 0, 0);
		new AcadColor(15, 0.5, 0.25, 0.25, 127.5, 63.75, 63.75);
		new AcadColor(16, 0.3, 0, 0, 76.5, 0, 0);
		new AcadColor(17, 0.3, 0.15, 0.15, 76.5, 38.25, 38.25);
		new AcadColor(18, 0.15, 0, 0, 38.25, 0, 0);
		new AcadColor(19, 0.15, 0.075, 0.075, 38.25, 19.125, 19.125);
		new AcadColor(20, 1, 0.25, 0, 255, 63.75, 0);
		new AcadColor(21, 1, 0.625, 0.5, 255, 159.375, 127.5);
		new AcadColor(22, 0.65, 0.1625, 0, 165.75, 41.4375, 0);
		new AcadColor(23, 0.65, 0.4063, 0.325, 165.75, 103.6065, 82.875);
		new AcadColor(24, 0.5, 0.125, 0, 127.5, 31.875, 0);
		new AcadColor(25, 0.5, 0.3125, 0.25, 127.5, 79.6875, 63.75);
		new AcadColor(26, 0.3, 0.075, 0, 76.5, 19.125, 0);
		new AcadColor(27, 0.3, 0.1875, 0.15, 76.5, 47.8125, 38.25);
		new AcadColor(28, 0.15, 0.0375, 0, 38.25, 9.5625, 0);
		new AcadColor(29, 0.15, 0.0938, 0.075, 38.25, 23.919, 19.125);
		new AcadColor(30, 1, 0.5, 0, 255, 127.5, 0);
		new AcadColor(31, 1, 0.75, 0.5, 255, 191.25, 127.5);
		new AcadColor(32, 0.65, 0.325, 0, 165.75, 82.875, 0);
		new AcadColor(33, 0.65, 0.4875, 0.325, 165.75, 124.3125, 82.875);
		new AcadColor(34, 0.5, 0.25, 0, 127.5, 63.75, 0);
		new AcadColor(35, 0.5, 0.375, 0.25, 127.5, 95.625, 63.75);
		new AcadColor(36, 0.3, 0.15, 0, 76.5, 38.25, 0);
		new AcadColor(37, 0.3, 0.225, 0.15, 76.5, 57.375, 38.25);
		new AcadColor(38, 0.15, 0.075, 0, 38.25, 19.125, 0);
		new AcadColor(39, 0.15, 0.1125, 0.075, 38.25, 28.6875, 19.125);
		new AcadColor(40, 1, 0.75, 0, 255, 191.25, 0);
		new AcadColor(41, 1, 0.875, 0.5, 255, 223.125, 127.5);
		new AcadColor(42, 0.65, 0.4875, 0, 165.75, 124.3125, 0);
		new AcadColor(43, 0.65, 0.5688, 0.325, 165.75, 145.044, 82.875);
		new AcadColor(44, 0.5, 0.375, 0, 127.5, 95.625, 0);
		new AcadColor(45, 0.5, 0.4375, 0.25, 127.5, 111.5625, 63.75);
		new AcadColor(46, 0.3, 0.225, 0, 76.5, 57.375, 0);
		new AcadColor(47, 0.3, 0.2625, 0.15, 76.5, 66.9375, 38.25);
		new AcadColor(48, 0.15, 0.1125, 0, 38.25, 28.6875, 0);
		new AcadColor(49, 0.15, 0.1313, 0.075, 38.25, 33.4815, 19.125);
		new AcadColor(50, 1, 1, 0, 255, 255, 0);
		new AcadColor(51, 1, 1, 0.5, 255, 255, 127.5);
		new AcadColor(52, 0.65, 0.65, 0, 165.75, 165.75, 0);
		new AcadColor(53, 0.65, 0.65, 0.325, 165.75, 165.75, 82.875);
		new AcadColor(54, 0.5, 0.5, 0, 127.5, 127.5, 0);
		new AcadColor(55, 0.5, 0.5, 0.25, 127.5, 127.5, 63.75);
		new AcadColor(56, 0.3, 0.3, 0, 76.5, 76.5, 0);
		new AcadColor(57, 0.3, 0.3, 0.15, 76.5, 76.5, 38.25);
		new AcadColor(58, 0.15, 0.15, 0, 38.25, 38.25, 0);
		new AcadColor(59, 0.15, 0.15, 0.075, 38.25, 38.25, 19.125);
		new AcadColor(60, 0.75, 1, 0, 191.25, 255, 0);
		new AcadColor(61, 0.875, 1, 0.5, 223.125, 255, 127.5);
		new AcadColor(62, 0.4875, 0.65, 0, 124.3125, 165.75, 0);
		new AcadColor(63, 0.5688, 0.65, 0.325, 145.044, 165.75, 82.875);
		new AcadColor(64, 0.375, 0.5, 0, 95.625, 127.5, 0);
		new AcadColor(65, 0.4375, 0.5, 0.25, 111.5625, 127.5, 63.75);
		new AcadColor(66, 0.225, 0.3, 0, 57.375, 76.5, 0);
		new AcadColor(67, 0.2625, 0.3, 0.15, 66.9375, 76.5, 38.25);
		new AcadColor(68, 0.1125, 0.15, 0, 28.6875, 38.25, 0);
		new AcadColor(69, 0.1313, 0.15, 0.075, 33.4815, 38.25, 19.125);
		new AcadColor(70, 0.5, 1, 0, 127.5, 255, 0);
		new AcadColor(71, 0.75, 1, 0.5, 191.25, 255, 127.5);
		new AcadColor(72, 0.325, 0.65, 0, 82.875, 165.75, 0);
		new AcadColor(73, 0.4875, 0.65, 0.325, 124.3125, 165.75, 82.875);
		new AcadColor(74, 0.25, 0.5, 0, 63.75, 127.5, 0);
		new AcadColor(75, 0.375, 0.5, 0.25, 95.625, 127.5, 63.75);
		new AcadColor(76, 0.15, 0.3, 0, 38.25, 76.5, 0);
		new AcadColor(77, 0.225, 0.3, 0.15, 57.375, 76.5, 38.25);
		new AcadColor(78, 0.075, 0.15, 0, 19.125, 38.25, 0);
		new AcadColor(79, 0.1125, 0.15, 0.075, 28.6875, 38.25, 19.125);
		new AcadColor(80, 0.25, 1, 0, 63.75, 255, 0);
		new AcadColor(81, 0.625, 1, 0.5, 159.375, 255, 127.5);
		new AcadColor(82, 0.1625, 0.65, 0, 41.4375, 165.75, 0);
		new AcadColor(83, 0.4063, 0.65, 0.325, 103.6065, 165.75, 82.875);
		new AcadColor(84, 0.125, 0.5, 0, 31.875, 127.5, 0);
		new AcadColor(85, 0.3125, 0.5, 0.25, 79.6875, 127.5, 63.75);
		new AcadColor(86, 0.075, 0.3, 0, 19.125, 76.5, 0);
		new AcadColor(87, 0.1875, 0.3, 0.15, 47.8125, 76.5, 38.25);
		new AcadColor(88, 0.0375, 0.15, 0, 9.5625, 38.25, 0);
		new AcadColor(89, 0.0938, 0.15, 0.075, 23.919, 38.25, 19.125);
		new AcadColor(90, 0, 1, 0, 0, 255, 0);
		new AcadColor(91, 0.5, 1, 0.5, 127.5, 255, 127.5);
		new AcadColor(92, 0, 0.65, 0, 0, 165.75, 0);
		new AcadColor(93, 0.325, 0.65, 0.325, 82.875, 165.75, 82.875);
		new AcadColor(94, 0, 0.5, 0, 0, 127.5, 0);
		new AcadColor(95, 0.25, 0.5, 0.25, 63.75, 127.5, 63.75);
		new AcadColor(96, 0, 0.3, 0, 0, 76.5, 0);
		new AcadColor(97, 0.15, 0.3, 0.15, 38.25, 76.5, 38.25);
		new AcadColor(98, 0, 0.15, 0, 0, 38.25, 0);
		new AcadColor(99, 0.075, 0.15, 0.075, 19.125, 38.25, 19.125);
		new AcadColor(100, 0, 1, 0.25, 0, 255, 63.75);
		new AcadColor(101, 0.5, 1, 0.625, 127.5, 255, 159.375);
		new AcadColor(102, 0, 0.65, 0.1625, 0, 165.75, 41.4375);
		new AcadColor(103, 0.325, 0.65, 0.4063, 82.875, 165.75, 103.6065);
		new AcadColor(104, 0, 0.5, 0.125, 0, 127.5, 31.875);
		new AcadColor(105, 0.25, 0.5, 0.3125, 63.75, 127.5, 79.6875);
		new AcadColor(106, 0, 0.3, 0.075, 0, 76.5, 19.125);
		new AcadColor(107, 0.15, 0.3, 0.1875, 38.25, 76.5, 47.8125);
		new AcadColor(108, 0, 0.15, 0.0375, 0, 38.25, 9.5625);
		new AcadColor(109, 0.075, 0.15, 0.0938, 19.125, 38.25, 23.919);
		new AcadColor(110, 0, 1, 0.5, 0, 255, 127.5);
		new AcadColor(111, 0.5, 1, 0.75, 127.5, 255, 191.25);
		new AcadColor(112, 0, 0.65, 0.325, 0, 165.75, 82.875);
		new AcadColor(113, 0.325, 0.65, 0.4875, 82.875, 165.75, 124.3125);
		new AcadColor(114, 0, 0.5, 0.25, 0, 127.5, 63.75);
		new AcadColor(115, 0.25, 0.5, 0.375, 63.75, 127.5, 95.625);
		new AcadColor(116, 0, 0.3, 0.15, 0, 76.5, 38.25);
		new AcadColor(117, 0.15, 0.3, 0.225, 38.25, 76.5, 57.375);
		new AcadColor(118, 0, 0.15, 0.075, 0, 38.25, 19.125);
		new AcadColor(119, 0.075, 0.15, 0.1125, 19.125, 38.25, 28.6875);
		new AcadColor(120, 0, 1, 0.75, 0, 255, 191.25);
		new AcadColor(121, 0.5, 1, 0.875, 127.5, 255, 223.125);
		new AcadColor(122, 0, 0.65, 0.4875, 0, 165.75, 124.3125);
		new AcadColor(123, 0.325, 0.65, 0.5688, 82.875, 165.75, 145.044);
		new AcadColor(124, 0, 0.5, 0.375, 0, 127.5, 95.625);
		new AcadColor(125, 0.25, 0.5, 0.4375, 63.75, 127.5, 111.5625);
		new AcadColor(126, 0, 0.3, 0.225, 0, 76.5, 57.375);
		new AcadColor(127, 0.15, 0.3, 0.2625, 38.25, 76.5, 66.9375);
		new AcadColor(128, 0, 0.15, 0.1125, 0, 38.25, 28.6875);
		new AcadColor(129, 0.075, 0.15, 0.1313, 19.125, 38.25, 33.4815);
		new AcadColor(130, 0, 1, 1, 0, 255, 255);
		new AcadColor(131, 0.5, 1, 1, 127.5, 255, 255);
		new AcadColor(132, 0, 0.65, 0.65, 0, 165.75, 165.75);
		new AcadColor(133, 0.325, 0.65, 0.65, 82.875, 165.75, 165.75);
		new AcadColor(134, 0, 0.5, 0.5, 0, 127.5, 127.5);
		new AcadColor(135, 0.25, 0.5, 0.5, 63.75, 127.5, 127.5);
		new AcadColor(136, 0, 0.3, 0.3, 0, 76.5, 76.5);
		new AcadColor(137, 0.15, 0.3, 0.3, 38.25, 76.5, 76.5);
		new AcadColor(138, 0, 0.15, 0.15, 0, 38.25, 38.25);
		new AcadColor(139, 0.075, 0.15, 0.15, 19.125, 38.25, 38.25);
		new AcadColor(140, 0, 0.75, 1, 0, 191.25, 255);
		new AcadColor(141, 0.5, 0.875, 1, 127.5, 223.125, 255);
		new AcadColor(142, 0, 0.4875, 0.65, 0, 124.3125, 165.75);
		new AcadColor(143, 0.325, 0.5688, 0.65, 82.875, 145.044, 165.75);
		new AcadColor(144, 0, 0.375, 0.5, 0, 95.625, 127.5);
		new AcadColor(145, 0.25, 0.4375, 0.5, 63.75, 111.5625, 127.5);
		new AcadColor(146, 0, 0.225, 0.3, 0, 57.375, 76.5);
		new AcadColor(147, 0.15, 0.2625, 0.3, 38.25, 66.9375, 76.5);
		new AcadColor(148, 0, 0.1125, 0.15, 0, 28.6875, 38.25);
		new AcadColor(149, 0.075, 0.1313, 0.15, 19.125, 33.4815, 38.25);
		new AcadColor(150, 0, 0.5, 1, 0, 127.5, 255);
		new AcadColor(151, 0.5, 0.75, 1, 127.5, 191.25, 255);
		new AcadColor(152, 0, 0.325, 0.65, 0, 82.875, 165.75);
		new AcadColor(153, 0.325, 0.4875, 0.65, 82.875, 124.3125, 165.75);
		new AcadColor(154, 0, 0.25, 0.5, 0, 63.75, 127.5);
		new AcadColor(155, 0.25, 0.375, 0.5, 63.75, 95.625, 127.5);
		new AcadColor(156, 0, 0.15, 0.3, 0, 38.25, 76.5);
		new AcadColor(157, 0.15, 0.225, 0.3, 38.25, 57.375, 76.5);
		new AcadColor(158, 0, 0.075, 0.15, 0, 19.125, 38.25);
		new AcadColor(159, 0.075, 0.1125, 0.15, 19.125, 28.6875, 38.25);
		new AcadColor(160, 0, 0.25, 1, 0, 63.75, 255);
		new AcadColor(161, 0.5, 0.625, 1, 127.5, 159.375, 255);
		new AcadColor(162, 0, 0.1625, 0.65, 0, 41.4375, 165.75);
		new AcadColor(163, 0.325, 0.4063, 0.65, 82.875, 103.6065, 165.75);
		new AcadColor(164, 0, 0.125, 0.5, 0, 31.875, 127.5);
		new AcadColor(165, 0.25, 0.3125, 0.5, 63.75, 79.6875, 127.5);
		new AcadColor(166, 0, 0.075, 0.3, 0, 19.125, 76.5);
		new AcadColor(167, 0.15, 0.1875, 0.3, 38.25, 47.8125, 76.5);
		new AcadColor(168, 0, 0.0375, 0.15, 0, 9.5625, 38.25);
		new AcadColor(169, 0.075, 0.0938, 0.15, 19.125, 23.919, 38.25);
		new AcadColor(170, 0, 0, 1, 0, 0, 255);
		new AcadColor(171, 0.5, 0.5, 1, 127.5, 127.5, 255);
		new AcadColor(172, 0, 0, 0.65, 0, 0, 165.75);
		new AcadColor(173, 0.325, 0.325, 0.65, 82.875, 82.875, 165.75);
		new AcadColor(174, 0, 0, 0.5, 0, 0, 127.5);
		new AcadColor(175, 0.25, 0.25, 0.5, 63.75, 63.75, 127.5);
		new AcadColor(176, 0, 0, 0.3, 0, 0, 76.5);
		new AcadColor(177, 0.15, 0.15, 0.3, 38.25, 38.25, 76.5);
		new AcadColor(178, 0, 0, 0.15, 0, 0, 38.25);
		new AcadColor(179, 0.075, 0.075, 0.15, 19.125, 19.125, 38.25);
		new AcadColor(180, 0.25, 0, 1, 63.75, 0, 255);
		new AcadColor(181, 0.625, 0.5, 1, 159.375, 127.5, 255);
		new AcadColor(182, 0.1625, 0, 0.65, 41.4375, 0, 165.75);
		new AcadColor(183, 0.4063, 0.325, 0.65, 103.6065, 82.875, 165.75);
		new AcadColor(184, 0.125, 0, 0.5, 31.875, 0, 127.5);
		new AcadColor(185, 0.3125, 0.25, 0.5, 79.6875, 63.75, 127.5);
		new AcadColor(186, 0.075, 0, 0.3, 19.125, 0, 76.5);
		new AcadColor(187, 0.1875, 0.15, 0.3, 47.8125, 38.25, 76.5);
		new AcadColor(188, 0.0375, 0, 0.15, 9.5625, 0, 38.25);
		new AcadColor(189, 0.0938, 0.075, 0.15, 23.919, 19.125, 38.25);
		new AcadColor(190, 0.5, 0, 1, 127.5, 0, 255);
		new AcadColor(191, 0.75, 0.5, 1, 191.25, 127.5, 255);
		new AcadColor(192, 0.325, 0, 0.65, 82.875, 0, 165.75);
		new AcadColor(193, 0.4875, 0.325, 0.65, 124.3125, 82.875, 165.75);
		new AcadColor(194, 0.25, 0, 0.5, 63.75, 0, 127.5);
		new AcadColor(195, 0.375, 0.25, 0.5, 95.625, 63.75, 127.5);
		new AcadColor(196, 0.15, 0, 0.3, 38.25, 0, 76.5);
		new AcadColor(197, 0.225, 0.15, 0.3, 57.375, 38.25, 76.5);
		new AcadColor(198, 0.075, 0, 0.15, 19.125, 0, 38.25);
		new AcadColor(199, 0.1125, 0.075, 0.15, 28.6875, 19.125, 38.25);
		new AcadColor(200, 0.75, 0, 1, 191.25, 0, 255);
		new AcadColor(201, 0.875, 0.5, 1, 223.125, 127.5, 255);
		new AcadColor(202, 0.4875, 0, 0.65, 124.3125, 0, 165.75);
		new AcadColor(203, 0.5688, 0.325, 0.65, 145.044, 82.875, 165.75);
		new AcadColor(204, 0.375, 0, 0.5, 95.625, 0, 127.5);
		new AcadColor(205, 0.4375, 0.25, 0.5, 111.5625, 63.75, 127.5);
		new AcadColor(206, 0.225, 0, 0.3, 57.375, 0, 76.5);
		new AcadColor(207, 0.2625, 0.15, 0.3, 66.9375, 38.25, 76.5);
		new AcadColor(208, 0.1125, 0, 0.15, 28.6875, 0, 38.25);
		new AcadColor(209, 0.1313, 0.075, 0.15, 33.4815, 19.125, 38.25);
		new AcadColor(210, 1, 0, 1, 255, 0, 255);
		new AcadColor(211, 1, 0.5, 1, 255, 127.5, 255);
		new AcadColor(212, 0.65, 0, 0.65, 165.75, 0, 165.75);
		new AcadColor(213, 0.65, 0.325, 0.65, 165.75, 82.875, 165.75);
		new AcadColor(214, 0.5, 0, 0.5, 127.5, 0, 127.5);
		new AcadColor(215, 0.5, 0.25, 0.5, 127.5, 63.75, 127.5);
		new AcadColor(216, 0.3, 0, 0.3, 76.5, 0, 76.5);
		new AcadColor(217, 0.3, 0.15, 0.3, 76.5, 38.25, 76.5);
		new AcadColor(218, 0.15, 0, 0.15, 38.25, 0, 38.25);
		new AcadColor(219, 0.15, 0.075, 0.15, 38.25, 19.125, 38.25);
		new AcadColor(220, 1, 0, 0.75, 255, 0, 191.25);
		new AcadColor(221, 1, 0.5, 0.875, 255, 127.5, 223.125);
		new AcadColor(222, 0.65, 0, 0.4875, 165.75, 0, 124.3125);
		new AcadColor(223, 0.65, 0.325, 0.5688, 165.75, 82.875, 145.044);
		new AcadColor(224, 0.5, 0, 0.375, 127.5, 0, 95.625);
		new AcadColor(225, 0.5, 0.25, 0.4375, 127.5, 63.75, 111.5625);
		new AcadColor(226, 0.3, 0, 0.225, 76.5, 0, 57.375);
		new AcadColor(227, 0.3, 0.15, 0.2625, 76.5, 38.25, 66.9375);
		new AcadColor(228, 0.15, 0, 0.1125, 38.25, 0, 28.6875);
		new AcadColor(229, 0.15, 0.075, 0.1313, 38.25, 19.125, 33.4815);
		new AcadColor(230, 1, 0, 0.5, 255, 0, 127.5);
		new AcadColor(231, 1, 0.5, 0.75, 255, 127.5, 191.25);
		new AcadColor(232, 0.65, 0, 0.325, 165.75, 0, 82.875);
		new AcadColor(233, 0.65, 0.325, 0.4875, 165.75, 82.875, 124.3125);
		new AcadColor(234, 0.5, 0, 0.25, 127.5, 0, 63.75);
		new AcadColor(235, 0.5, 0.25, 0.375, 127.5, 63.75, 95.625);
		new AcadColor(236, 0.3, 0, 0.15, 76.5, 0, 38.25);
		new AcadColor(237, 0.3, 0.15, 0.225, 76.5, 38.25, 57.375);
		new AcadColor(238, 0.15, 0, 0.075, 38.25, 0, 19.125);
		new AcadColor(239, 0.15, 0.075, 0.1125, 38.25, 19.125, 28.6875);
		new AcadColor(240, 1, 0, 0.25, 255, 0, 63.75);
		new AcadColor(241, 1, 0.5, 0.625, 255, 127.5, 159.375);
		new AcadColor(242, 0.65, 0, 0.1625, 165.75, 0, 41.4375);
		new AcadColor(243, 0.65, 0.325, 0.4063, 165.75, 82.875, 103.6065);
		new AcadColor(244, 0.5, 0, 0.125, 127.5, 0, 31.875);
		new AcadColor(245, 0.5, 0.25, 0.3125, 127.5, 63.75, 79.6875);
		new AcadColor(246, 0.3, 0, 0.075, 76.5, 0, 19.125);
		new AcadColor(247, 0.3, 0.15, 0.1875, 76.5, 38.25, 47.8125);
		new AcadColor(248, 0.15, 0, 0.0375, 38.25, 0, 9.5625);
		new AcadColor(249, 0.15, 0.075, 0.0938, 38.25, 19.125, 23.919);
		new AcadColor(250, 0.33, 0.33, 0.33, 84.15, 84.15, 84.15);
		new AcadColor(251, 0.464, 0.464, 0.464, 118.32, 118.32, 118.32);
		new AcadColor(252, 0.598, 0.598, 0.598, 152.49, 152.49, 152.49);
		new AcadColor(253, 0.732, 0.732, 0.732, 186.66, 186.66, 186.66);
		new AcadColor(254, 0.866, 0.866, 0.866, 220.83, 220.83, 220.83);
		new AcadColor(255, 1.0, 1.0, 1.0, 255.0, 255.0, 255.0);
		return AcadColor.colors;
	}
1197926
function createTables() {
  return bluebird.all(getComponents().map(component => client.createTable(`components.${component}`)))
    .then(() => bluebird.all(getLayouts().map(layout => client.createTableWithMeta(`layouts.${layout}`))))
    .then(() => client.createTableWithMeta('pages'))
    .then(() => client.raw('CREATE TABLE IF NOT EXISTS ?? ( id TEXT PRIMARY KEY NOT NULL, data TEXT NOT NULL, url TEXT );', ['uris']))
    .then(() => createRemainingTables());
}
1011900
function colorgrad() {
    var args = Array.prototype.slice.call(arguments)
      , arraymath = require('./arraymath')
      , spec
      , cstep
      , c1 = args[0]
      , c2 = null
      , rgb1
      , rgb2
      , outType = isArray(c1) ? 'rgb': 'hex'
      , add = arraymath("+")
      , sub = arraymath("-")
      , div = arraymath("/")
      , mul = arraymath("*")

    /*
     *
     * Unpack specification object
     *
     */
    if(isObj(args[1])) {
      spec = args[1]
    }
    else if (isObj(args[2])) {
      spec = args[2]
      c2 = args[1]
    }
    else
      spec = {}
    /*
     * Or with defaults
     */
    var lum = spec.lum || 1
      , n = spec.nshades || 100
      , type = spec.type || "linear"

    /*
     *
     * Design the color step array which will be
     * a length 3 vector.
     *
     */
    rgb1 = isArray(c1) ? c1 : hex2rgb(c1)
    if(c2) // If two hexcolors supplied
      rgb2 = isArray(c2) ? c2 : hex2rgb(c2)
    else // 2nd color is lum% incr/decr of color1
      rgb2 = add( mul(rgb1,[lum]), rgb1)

    // Create step size to step through color gradient
    cstep = div( sub(rgb2, rgb1), [n-1])

    var i
      , nc = []
    nc[0] = rgb1
    for (i = 1; i < n; ++i) {
      nc[i] = add(nc[i-1], cstep)
    }

    function clims(c) {
      if(c > 255)
        return 255
      else if(c < 0)
        return 0
      else return c
    }

    var result = []
    nc.forEach(function (ar) {
      ar = ar.map(Math.round).map(clims)
      if(outType === 'hex')
        ar = rgb2hex(ar)
      result.push( ar )
    })
    return result
  }
1223592
def _downgrade_v4(op):
    
    op.drop_index('ix_equities_fuzzy_symbol')
    op.drop_index('ix_equities_company_symbol')

    op.execute("UPDATE equities SET exchange = exchange_full")

    with op.batch_alter_table('equities') as batch_op:
        batch_op.drop_column('exchange_full')

    op.create_index('ix_equities_fuzzy_symbol',
                    table_name='equities',
                    columns=['fuzzy_symbol'])
    op.create_index('ix_equities_company_symbol',
                    table_name='equities',
                    columns=['company_symbol'])
1179901
private boolean updateTintColor(int[] state) {
        final int trackColor = mTrackStateList.getColorForState(state, mTrackColor);
        final int scrubberColor = mScrubberStateList.getColorForState(state, mScrubberColor);
        final int thumbColor = mThumbStateList.getColorForState(state, mThumbColor);

        if (trackColor != mTrackColor || scrubberColor != mScrubberColor || thumbColor != mThumbColor) {
            mTrackColor = trackColor;
            mScrubberColor = scrubberColor;
            mThumbColor = thumbColor;
            updateCurColor();
            invalidateSelf();
            return true;
        }

        return false;
    }
776808
protected function initsTable()
    {
        $this->sTable = [];

        for ($i = 0; $i < 256; $i++) {
            $this->sTable[$i] = \chr($i);
        }

        $this->tIdx = 258;
        $this->bitsToGet = 9;
    }
1166961
def build_colormap(palette, info):
        """"""

        from trollimage.colormap import Colormap
        if 'palette_meanings' in palette.attrs:
            palette_indices = palette.attrs['palette_meanings']
        else:
            palette_indices = range(len(palette))

        sqpalette = np.asanyarray(palette).squeeze() / 255.0
        tups = [(val, tuple(tup))
                for (val, tup) in zip(palette_indices, sqpalette)]
        colormap = Colormap(*tups)
        if 'palette_meanings' not in palette.attrs:
            sf = info.get('scale_factor', np.array(1))
            colormap.set_range(
                *(np.array(info['valid_range']) * sf + info.get('add_offset', 0)))

        return colormap, sqpalette
754985
private void createOrUpdateTable(String tablename, HTableDescriptor hTableDescriptor)
    {
        try
        {
            if (admin.isTableAvailable(tablename))
            {
                admin.modifyTable(tablename, hTableDescriptor);
            }
            else
            {
                admin.createTable(hTableDescriptor);
            }
        }
        catch (IOException ioex)
        {
            logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex);
            throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem.");
        }
    }
715287
def _downgrade_v1(op):
    
    # Drop indices before batch
    # This is to prevent index collision when creating the temp table
    op.drop_index('ix_futures_contracts_root_symbol')
    op.drop_index('ix_futures_contracts_symbol')

    # Execute batch op to allow column modification in SQLite
    with op.batch_alter_table('futures_contracts') as batch_op:

        # Rename 'multiplier'
        batch_op.alter_column(column_name='multiplier',
                              new_column_name='contract_multiplier')

        # Delete 'tick_size'
        batch_op.drop_column('tick_size')

    # Recreate indices after batch
    op.create_index('ix_futures_contracts_root_symbol',
                    table_name='futures_contracts',
                    columns=['root_symbol'])
    op.create_index('ix_futures_contracts_symbol',
                    table_name='futures_contracts',
                    columns=['symbol'],
                    unique=True)
1167399
public void automaticColor()
    {
        final Map<TileRef, ColorRgba> colors = new HashMap<>();
        for (final Integer sheet : map.getSheets())
        {
            computeSheet(colors, sheet);
        }
        pixels = colors;
    }
193684
def _colors_to_code(self, fg_color, bg_color):
        "  "
        # When requesting ANSI colors only, and both fg/bg color were converted
        # to ANSI, ensure that the foreground and background color are not the
        # same. (Unless they were explicitely defined to be the same color.)
        fg_ansi = [()]

        def get(color, bg):
            table = BG_ANSI_COLORS if bg else FG_ANSI_COLORS

            if color is None:
                return ()

            # 16 ANSI colors. (Given by name.)
            elif color in table:
                return (table[color], )

            # RGB colors. (Defined as 'ffffff'.)
            else:
                try:
                    rgb = self._color_name_to_rgb(color)
                except ValueError:
                    return ()

                # When only 16 colors are supported, use that.
                if self.ansi_colors_only():
                    if bg:  # Background.
                        if fg_color != bg_color:
                            exclude = (fg_ansi[0], )
                        else:
                            exclude = ()
                        code, name = _16_bg_colors.get_code(rgb, exclude=exclude)
                        return (code, )
                    else:  # Foreground.
                        code, name = _16_fg_colors.get_code(rgb)
                        fg_ansi[0] = name
                        return (code, )

                # True colors. (Only when this feature is enabled.)
                elif self.true_color:
                    r, g, b = rgb
                    return (48 if bg else 38, 2, r, g, b)

                # 256 RGB colors.
                else:
                    return (48 if bg else 38, 5, _256_colors[rgb])

        result = []
        result.extend(get(fg_color, False))
        result.extend(get(bg_color, True))

        return map(six.text_type, result)
1329281
def update_colors(self, colors):
        ''''''
        self.colors = np.array(colors, dtype='uint8')
        prim_colors = self._gen_colors(self.colors)
        
        self._color_vbo.set_data(prim_colors)
        self.widget.update()
748039
def set_colorization_enabled(enabled):
    
    # If color is supposed to be enabled and this is windows, we have to enable console virtual terminal sequences:
    if enabled and platform.system() == 'Windows':
        Colors.COLORIZATION_ENABLED = enable_windows_virtual_terminal_sequences()
    else:
        # This is not windows so we can enable color immediately.
        Colors.COLORIZATION_ENABLED = enabled