initial setup of single color options and variables
172038
def setup_singlecolor(self):
        
        self.singlecolorframe = tk.Frame(self.tab_configure, bg=self.single_color_theme)
        channel_choices = sorted(list(self.data.keys()))
        self.singlecolorlabel = tk.Label(self.singlecolorframe, text="single", bg=self.single_color_theme, width=10)
        self.singlecolorvar = tk.StringVar()
        self.singlecolorpower = tk.DoubleVar()
        self.singlecolormin = tk.DoubleVar()
        self.singlecolormax = tk.DoubleVar()
        self.singlecolordropdown = tk.OptionMenu(self.singlecolorframe, self.singlecolorvar, *channel_choices)
        self.singlecolorscale = tk.Scale(self.singlecolorframe, variable=self.singlecolorpower,
                                         orient=tk.HORIZONTAL, from_=self.config.ranges['single_color_power_min'],
                                         bg=self.single_color_theme,
                                         to_=self.config.ranges['single_color_power_max'],
                                         resolution=self.config.ranges['single_color_power_resolution'],
                                         length=200)
        self.singlecolorminscale = tk.Scale(self.singlecolorframe, variable=self.singlecolormin,
                                            orient=tk.HORIZONTAL, from_=0,
                                            bg=self.single_color_theme,
                                            to_=self.config.ranges['single_color_vmin'],
                                            resolution=self.config.ranges['single_color_vresolution'], length=200)

        self.singlecolormaxscale = tk.Scale(self.singlecolorframe, variable=self.singlecolormax,
                                            orient=tk.HORIZONTAL, from_=self.config.ranges['single_color_vmax'],
                                            bg=self.single_color_theme,
                                            to_=100, resolution=self.config.ranges['single_color_vresolution'],
                                            length=200)

        self.singlecolorvar.set(self.config.products_map[self.config.default['single']])
        self.singlecolorpower.set(self.config.default['single_power'])
        self.singlecolormin.set(0)
        self.singlecolormax.set(100)
        self.singlecolordropdown.config(bg=self.single_color_theme, width=10)
        self.singlecolorlabel.pack(side=tk.LEFT)
        self.singlecolorscale.pack(side=tk.RIGHT)
        self.singlecolormaxscale.pack(side=tk.RIGHT)
        self.singlecolorminscale.pack(side=tk.RIGHT)
        self.singlecolordropdown.pack()
        self.singlecolorframe.grid(row=4, columnspan=5, rowspan=1)
50422
function(ui)
              {
                switch (settings.color.mode)
                {
                  case 'h':
                    setBG.call($this, colorMapDiv, new Color({ h: ui.val('h') || 0, s: 100, v: 100 }).val('hex'));
                    break;
                  case 's':
                  case 'a':
                    var s = ui.val('s');
                    setAlpha.call($this, colorMapL2, 100 - (s != null ? s : 100));
                    break;
                  case 'v':
                    var v = ui.val('v');
                    setAlpha.call($this, colorMapL1, v != null ? v : 100);
                    break;
                  case 'r':
                    setAlpha.call($this, colorMapL2, Math.precision((ui.val('r') || 0) / 255 * 100, 4));
                    break;
                  case 'g':
                    setAlpha.call($this, colorMapL2, Math.precision((ui.val('g') || 0) / 255 * 100, 4));
                    break;
                  case 'b':
                    setAlpha.call($this, colorMapL2, Math.precision((ui.val('b') || 0) / 255 * 100));
                    break;
                }
                var a = ui.val('a');
                setAlpha.call($this, colorMapL3, Math.precision(((255 - (a || 0)) * 100) / 255, 4));
              }
453336
def color_scheme(editor, variables):
    
    colorscheme = variables.get('colorscheme')
    if colorscheme:
        editor.use_colorscheme(colorscheme)
694713
function (xy, yz) { // function for pure rendering. No rendering elsewhere!!
    var CP = colorPicker.CP,
      cP = colorPicker.cP,
      a = 0,
      b = 0,
      c = 0,
      ctrDif, colDif, tmpHSV, nCtr, nrCtr, cPCtr, WS; // cP & CP = scope shifting
    // display all the nice colors in sliders
    if (xy) { // left slider -> right
      if (CP.xyz[0] > CP.xyz[1]) b = 1;
      else a = 1;
      if (CP.mode == 'S' || CP.mode == 'V') {
        cP.cPSR2s.backgroundColor = 'rgb(' + HSV2RGB(CP.xyz[0], 255, 255) + ')';
        b = 1;
        c = 255
      } else if (CP.mode != 'H' && !CP.modeRGB[CP.mode]) cP.cPSR2.className = 'cPSR' + (2 + a) + CP.mode + ' cPOP' + Math.round((CP.xyz[a] - CP.xyz[b]) / (255 - CP.xyz[b]) * 100 || 0);
      if (CP.mode != 'H' && !CP.modeRGB[CP.mode]) cP.cPSR3.className = 'cPSR4' + CP.mode + ' cPOP' + Math.round(Math.abs(c - CP.xyz[b]) / 2.55);
      cP.cPSLCs.cssText = 'left:' + (CP.xyz[0] / sX - 5) + 'px;top:' + Math.ceil(250 - CP.xyz[1] / sX / sZ - xyzCorr) + 'px'; // change cursor
    }
    if (!xy || yz) { // right slider -> left
      if (CP.mode == 'H') {
        tmpHSV = HSV2RGB(CP.xyz[2], 255, 255);
        cP.cPSL1s.backgroundColor = 'rgb(' + tmpHSV + ')'
      } else cP.cPSL3.className = 'cPSL3' + CP.mode + ' cPOP' + (100 - Math.round(CP.xyz[2] / 2.55));
      cP.cPSRCLs.top = c = +Math.ceil(252 - CP.xyz[2] / sX / sZ - xyzCorr) + 'px'; // change right-left cursor ... recycle var c
      if (yz) cP.cPSRCRs.top = c; // change right-right cursor
    }

    // switch brightness if contrast changes
    cPCtr = getBrightness(CP.rgbRND);
    nCtr = cPCtr > 128;
    if (cCtr !== nCtr) {
      if (nCtr) {
        if (expColor) cP.cObjs.color = '#222';
        cP.cPSLC.className = 'cPSLCB';
        CP.cPM0CN = 'cPM0 cPM0B';
        if (CP.mode != 'H' && !CP.modeRGB[CP.mode]) {
          cP.cPSRCL.className = 'cPSRCLB';
          if (xy) cP.cPSRCR.className = 'cPSRCRB'
        }
      } else {
        if (expColor) cP.cObjs.color = '#ddd';
        cP.cPSLC.className = 'cPSLCW';
        CP.cPM0CN = 'cPM0';
        if (CP.mode != 'H' && !CP.modeRGB[CP.mode]) {
          cP.cPSRCL.className = 'cPSRCLW';
          if (xy) cP.cPSRCR.className = 'cPSRCRW'
        }
      }
    }
    cCtr = nCtr;
    if (!xy || yz) { // only right
      if (CP.modeRGB[CP.mode]) {
        nrCtr = CP.xyz[2] > 153;
        if (crCtr !== nrCtr) { // RGB special mode
          if (nrCtr && CP.mode == 'G') {
            cP.cPSRCL.className = 'cPSRCLB';
            if (xy) cP.cPSRCR.className = 'cPSRCRB';
          } else {
            cP.cPSRCL.className = 'cPSRCLW';
            if (xy) cP.cPSRCR.className = 'cPSRCRW'
          }
        }
      } else if (CP.mode == 'H') { // HSB_H mode extra rules
        nrCtr = getBrightness(tmpHSV || HSV2RGB(CP.hsv[0], 255, 255)) > 128;
        if (crCtr !== nrCtr) {
          if (nrCtr) cP.cPSRCL.className = 'cPSRCLB';
          else cP.cPSRCL.className = 'cPSRCLW'
        }
      }
      crCtr = nrCtr;
    }

    // display brightness/color match bar
    colDif = getColorDifference(CP.CB2Color, CP.rgb) / 765 * difWidth; // 765 = 3 colors * 255 possible values
    ctrDif = Math.abs((cPCtr - CP.iCtr) / 255 * difWidth);
    cP.cPCTRTs.cssText = 'width:' + ctrDif + 'px;' + ((colDif > ctrDif) ? cP.CTRTop : '');
    cP.cPCDs.cssText = 'width:' + colDif + 'px;' + ((ctrDif < difWidth / 2 && colDif < difWidth / 3 * 2) ? '' : ((ctrDif < difWidth / 2 || colDif < difWidth / 3 * 2) ? cP.cPCD1 : cP.cPCD2));

    // display color values // this also touches the DOM
    cP.cPIR.value = CP.rgbRND[0];
    cP.cPIG.value = CP.rgbRND[1];
    cP.cPIB.value = CP.rgbRND[2];
    cP.cPIH.value = Math.round(CP.hsv[0] / 255 * 360);
    cP.cPIS.value = Math.round(CP.hsv[1] / 2.55);
    cP.cPIV.value = Math.round(CP.hsv[2] / 2.55);
    cP.cPIC.value = CP.cmyk[0];
    cP.cPIM.value = CP.cmyk[1];
    cP.cPIY.value = CP.cmyk[2];
    cP.cPIK.value = CP.cmyk[3];
    cP.cPIX.value = CP.hex;

    // display WEBSave/WEBSmart/otherColor button
    WS = (CP.rgbRND[0] % 51 == 0 && CP.rgbRND[1] % 51 == 0 && CP.rgbRND[2] % 51 == 0) ? 'W' : (CP.rgbRND[0] % 17 == 0 && CP.rgbRND[1] % 17 == 0 && CP.rgbRND[2] % 17 == 0) ? 'M' : '!';
    if (WS != CP.WS) cP.cPBRX.firstChild.data = CP.WS = WS;

    // display value/color in initField swatch and left/background
    cP.cPCB1s.backgroundColor = 'rgb(' + CP.rgbRND + ')';
    if (expColor) cP.cObjs.backgroundColor = 'rgb(' + CP.rgbRND + ')';
    if (expHEX) cP.cObj.value = CP.valPrefix + CP.hex;
    if (CP.bd) document.body.style.background = 'rgb(' + CP.rgbRND + ')';

    if (colorPicker.exportColor) colorPicker.exportColor();
    if (xy && yz) { // stopRender
      cP.cPSRCR.className = cP.cPSRCL.className.replace('L', 'R'); // ;o)
      cP.cPM0s.backgroundColor = 'rgb(' + CP.rgbRND + ')';
      if (CP.cPM0CN) {
        cP.cPM0.className = CP.cPM0CN;
        CP.cPM0CN = ''
      }
    }
  }
953246
function checkUserColors(colorUser){
  if(terminal.colors){
    for(var name in colorUser){
      colorUser[name]= setUserColor(colorUser[name]);
      }
  }
  else{
    throw new Error("There is no colors object defined");
  }
}
1179155
def init():
    """"""
    global _default_foreground, _default_background, _default_style
    try:
        attrs = GetConsoleScreenBufferInfo().wAttributes
    except (ArgumentError, WindowsError):
        _default_foreground = GREY
        _default_background = BLACK
        _default_style = NORMAL
    else:
        _default_foreground = attrs & 7
        _default_background = (attrs >> 4) & 7
        _default_style = attrs & BRIGHT
278550
function prepareColors(colors) {
    Object.keys(colors).forEach(function (color) {
        var code = colors[color],
            replaced = replaceColors(code, colors);

        if (replaced !== code) {
            colors[color] = replaced;
        }
    });
}
887588
def setup(
	work_dir=".resort",
	profiles=None
):

	
	
	# Initialize colorama
	colorama.init()
	
	# Program name
	prog_name = sys.argv[0]
	
	# Profile manager
	prof_mgr = engine.ProfileManager(os.getcwd(), work_dir, profiles)
	
	# Retrieve arguments
	parser = argparse.ArgumentParser(
		prog=prog_name
	)
	parser.add_argument(
		"profile",
		metavar="profile",
		type=str,
		nargs=1,
		help="Profile name"
	)
	parser.add_argument(
		"command",
		metavar="command",
		type=argparse_command,
		nargs=1,
		help="Command name"
	)
	parser.add_argument(
		"arguments",
		metavar="args",
		nargs=argparse.REMAINDER,
		help="Command arguments"
	)
	args = parser.parse_args(sys.argv[1:])
	
	# Execute command
	cmd_name, cmd_fn = args.command[0]
	cmd_prog_name = "{} profile {}".format(prog_name, cmd_name)
	prof_name = args.profile[0]
	prog_args = args.arguments
	cmd_fn(cmd_prog_name, prof_mgr, prof_name, prog_args)
1033731
def set_rgb(self, red, green, blue):
        
        x, y = rgb_to_xy(red, green, blue)
        self.xy = [x, y]
280247
def main(context, no_color):
    
    if context.obj is None:
        context.obj = {}
    context.obj['no_color'] = no_color
56900
function init(input) {

		// rgba
		result = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(input);
		if (result) {
			rgba = [pInt(result[1]), pInt(result[2]), pInt(result[3]), parseFloat(result[4], 10)];
		} else { // hex
			result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(input);
			if (result) {
				rgba = [pInt(result[1], 16), pInt(result[2], 16), pInt(result[3], 16), 1];
			}
		}

	}
649366
function init(input) {

            // Gradients
            if (input && input.stops) {
                stops = map(input.stops, function (stop) {
                    return Color(stop[1]);
                });

                // Solid colors
            } else {
                // rgba
                result = rgbaRegEx.exec(input);
                if (result) {
                    rgba = [pInt(result[1]), pInt(result[2]), pInt(result[3]), parseFloat(result[4], 10)];
                } else {
                    // hex
                    result = hexRegEx.exec(input);
                    if (result) {
                        rgba = [pInt(result[1], 16), pInt(result[2], 16), pInt(result[3], 16), 1];
                    } else {
                        // rgb
                        result = rgbRegEx.exec(input);
                        if (result) {
                            rgba = [pInt(result[1]), pInt(result[2]), pInt(result[3]), 1];
                        }
                    }
                }
            }

        }
433235
public void setIntColor(int x, int y, int alpha, int c0, int c1, int c2) {
        arrIntColor[((y * image.getWidth() + x))] = (alpha << 24) +
                (c0 << 16) +
                (c1 << 8) +
                c2;
    }
624712
function ( type, settings, parent, colors ) {

        T.dom( type, null, settings, parent, 0 );

        var n = parent.childNodes[0].childNodes.length - 1, c;

        for( var i = 0; i < colors.length; i++ ){

            c = colors[i];
            T.dom( 'stop', null, { offset:c[0]+'%', style:'stop-color:'+c[1]+'; stop-opacity:'+c[2]+';' }, parent, [0,n] );

        }

    }
228777
def set(cls, color):
        
        sys.stdout.write(cls.colors.get(color, cls.colors['RESET']))
859208
def generateDefaultColorRamp(cls, colorRampEnum):
        
        hue = [(255, 0, 255), (231, 0, 255), (208, 0, 255), (185, 0, 255), (162, 0, 255), (139, 0, 255), (115, 0, 255), (92, 0, 255), (69, 0, 255), (46, 0, 255), (23, 0, 255),        # magenta to blue
                   (0, 0, 255), (0, 23, 255), (0, 46, 255), (0, 69, 255), (0, 92, 255), (0, 115, 255), (0, 139, 255), (0, 162, 255), (0, 185, 255), (0, 208, 255), (0, 231, 255),          # blue to cyan
                   (0, 255, 255), (0, 255, 231), (0, 255, 208), (0, 255, 185), (0, 255, 162), (0, 255, 139), (0, 255, 115), (0, 255, 92), (0, 255, 69), (0, 255, 46), (0, 255, 23),        # cyan to green
                   (0, 255, 0), (23, 255, 0), (46, 255, 0), (69, 255, 0), (92, 255, 0), (115, 255, 0), (139, 255, 0), (162, 255, 0), (185, 255, 0), (208, 255, 0), (231, 255, 0),          # green to yellow
                   (255, 255, 0), (255, 243, 0), (255, 231, 0), (255, 220, 0), (255, 208, 0), (255, 197, 0), (255, 185, 0), (255, 174, 0), (255, 162, 0), (255, 151, 0), (255, 139, 0),    # yellow to orange
                   (255, 128, 0), (255, 116, 0), (255, 104, 0), (255, 93, 0), (255, 81, 0), (255, 69, 0), (255, 58, 0), (255, 46, 0), (255, 34, 0), (255, 23, 0), (255, 11, 0),            # orange to red
                   (255, 0, 0)]                                                                                                                                                            # red

        terrain = [(0, 100, 0), (19, 107, 0), (38, 114, 0), (57, 121, 0), (76, 129, 0), (95, 136, 0), (114, 143, 0), (133, 150, 0), (152, 158, 0), (171, 165, 0), (190, 172, 0),                   # dark green to golden rod yellow
                   (210, 180, 0), (210, 167, 5), (210, 155, 10), (210, 142, 15), (210, 130, 20), (210, 117, 25),                                                                                   # golden rod yellow to orange brown
                   (210, 105, 30), (188, 94, 25), (166, 83, 21), (145, 72, 17), (123, 61, 13), (101, 50, 9),                                                                                       # orange brown to dark brown
                   (80, 40, 5), (95, 59, 27), (111, 79, 50), (127, 98, 73), (143, 118, 95), (159, 137, 118),(175, 157, 141), (191, 176, 164), (207, 196, 186), (223, 215, 209), (239, 235, 232),   # dark brown to white
                   (255, 255, 255)]                                                                                                                                                                # white

        aqua = [(150, 255, 255), (136, 240, 250), (122, 226, 245), (109, 212, 240), (95, 198, 235), (81, 184, 230), (68, 170, 225), (54, 156, 220), (40, 142, 215), (27, 128, 210), (13, 114, 205), # aqua to blue
                (0, 100, 200), (0, 94, 195), (0, 89, 191), (0, 83, 187), (0, 78, 182), (0, 72, 178), (0, 67, 174), (0, 61, 170), (0, 56, 165), (0, 50, 161), (0, 45, 157), (0, 40, 153),            # blue to navy blue
                (0, 36, 143), (0, 32, 134), (0, 29, 125), (0, 25, 115), (0, 21, 106), (0, 18, 97), (0, 14, 88), (0, 10, 78), (0, 7, 69), (0, 3, 60), (0, 0, 51)]                                    # navy blue to dark navy blue


        if (colorRampEnum == ColorRampEnum.COLOR_RAMP_HUE):
            return hue

        elif (colorRampEnum == ColorRampEnum.COLOR_RAMP_TERRAIN):
            return terrain

        elif (colorRampEnum == ColorRampEnum.COLOR_RAMP_AQUA):
            return aqua
426521
def init_goid2color(self):
        """"""
        goid2color = {}
        # 1. User-specified colors for each GO term
        if 'go2color' in self.kws:
            for goid, color in self.kws['go2color'].items():
                goid2color[goid] = color
        # 2. colors based on p-value override colors based on source GO
        if self.objgoea is not None:
            self.objgoea.set_goid2color_pval(goid2color)
        key2color = self.kws.get('key2col')
        if key2color is not None:
            # 3. Default GO source color
            if 'go_sources' in key2color:
                color = key2color['go_sources']
                go2obj = self.gosubdag.go2obj
                for goid in self.gosubdag.go_sources:
                    if goid not in goid2color:
                        goobj = go2obj[goid]
                        goid2color[goobj.id] = color
                        goid2color[goid] = color
            # 4. Level-01 GO color
            if 'level_01' in key2color:
                color = key2color['level_01']
                for goid, goobj in self.gosubdag.go2obj.items():
                    if goobj.level == 1:
                        if goid not in goid2color:
                            goid2color[goid] = color
        return goid2color