Create a function for the given color
    Done inside this function to keep the variables out of the main scope
972750
def create_color_method(color, code):
    

    def func(self, content=''):
        return self._apply_color(code, content)  # pylint: disable=protected-access

    setattr(Terminal, color, func)
1328470
function(colorStops) {
			var from = 0;
			
			colorStops.forEach(function(cs, i) {
				// make sure that first and last positions are defined
				if (!i) {
					return cs.position = cs.position || 0;
				}
				
				if (i == colorStops.length - 1 && !('position' in cs)) {
					cs.position = 1;
				}
				
				if ('position' in cs) {
					var start = colorStops[from].position || 0;
					var step = (cs.position - start) / (i - from);
					colorStops.slice(from, i).forEach(function(cs2, j) {
						cs2.position = start + step * j;
					});
					
					from = i;
				}
			});
		}
1272610
function markVariableAsUsed(context, name) {
  let scope = context.getScope();
  let variables;
  let i;
  let len;
  let found = false;

  // Special Node.js scope means we need to start one level deeper
  if (scope.type === 'global') {
    while (scope.childScopes.length) {
      scope = scope.childScopes[0];
    }
  }

  do {
    variables = scope.variables;
    for (i = 0, len = variables.length; i < len; i++) { // eslint-disable-line no-plusplus
      if (variables[i].name === name) {
        variables[i].eslintUsed = true;
        found = true;
      }
    }
    scope = scope.upper;
  } while (scope);

  return found;
}
503606
function Dummy() {
    "use strict";
    this.colorize = function colorize(text, styleName, pad) {
        return text;
    };
    this.format = function format(text, style, pad){
        return text;
    };
}
918524
function Scope(parent) {
  var map = Object.create(null);
  var api = {};
  api.markAsUsed = function(k) {
    if (typeof k !== "string") {
      throw new Error("Scope keys must be strings: " + k);
    }
    if (api.hasOwnVar(k)) {
      map[k].used = true;
      return api;
    }
    if (parent) {
      return parent.markAsUsed(k);
    }
    throw new Error("tried to use a variable before declaration: " + k);
  };
  api.ownUnusedVars = function() {
    return Object
      .keys(map)
      .filter(function(k) { return !map[k].used; })
      .map(function(k) { return map[k]; });
  };
  api.get = function(k) {
    if (api.hasOwnVar(k)) {
      return map[k];
    }
    if (parent) {
      return parent.get(k);
    }
    throw new Error("no such variable " + k);
  };
  api.declare = function(k, v) {
    // v.line :: number
    // v.column :: number
    // v.used :: boolean

    // Underscore is not a valid variable, so don't put it in the scope.
    if (k === "_") {
      return api;
    }
    v.name = k;
    // TODO: Unbreak the linter so I can use this check. Redeclaring a variable is not ok, but it's currently happening due to hoisting.
    // if (api.hasOwnVar(k)) {
    //     throw new Error("cannot redeclare variable " + k);
    // }
    if (api.hasOwnVar(k)) {
      v.used = api.get(k).used;
    }
    map[k] = v;
    return api;
  };
  api.hasVar = function(k) {
    if (api.hasOwnVar(k)) {
      return true;
    }
    if (parent) {
      return parent.hasVar(k);
    }
    return false;
  };
  api.hasOwnVar = function(k) {
    return {}.hasOwnProperty.call(map, k);
  };
  api.ownVars = function() {
    return Object.keys(map);
  };
  api.bareToString = function() {
    var innards = Object
      .keys(map)
      .map(function(k) {
        return k + ":" + (map[k].used ? "T" : "F");
      })
      .join(" ");
    var s = "{" + innards + "}";
    if (parent) {
      return parent.bareToString() + " > " + s;
    }
    return s;
  };
  api.toString = function() {
    return "#Scope[" + api.bareToString() + "]";
  };
  api.parent = parent;
  return Object.freeze(api);
}
609119
function ( color, errorMsg ) {
            color = this.KEYWORDS[color.toLowerCase()];
            if ( color ) {
                return color;
            } else {
                if ( errorMsg ) warning( errorMsg );
                return undefined;
            }
        }
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));
              }
389397
function(otherColor) {
      if (!(otherColor instanceof Color)) {
        otherColor = new Color(otherColor);
      }

      var result = [],
          alpha = this.getAlpha(),
          otherAlpha = 0.5,
          source = this.getSource(),
          otherSource = otherColor.getSource();

      for (var i = 0; i < 3; i++) {
        result.push(Math.round((source[i] * (1 - otherAlpha)) + (otherSource[i] * otherAlpha)));
      }

      result[3] = alpha;
      this.setSource(result);
      return this;
    }
213505
function Hue() {
        Channel.apply(this, arguments);
        this.dataType = NUMBER | HUE;
        this.cssType = NUMBER;
        this.range = [0, 360];
        this.filter = MOD;
        this.initial = 0;
    }
497002
def _wrap_with(color_code):
    '''
    '''
    def inner(text, bold=False):
        '''Inner color function.'''
        code = color_code
        if bold:
            code = flo("1;{code}")
        return flo('\033[{code}m{text}\033[0m')
    return inner
943799
def color_worker(srcs, window, ij, args):
    """"""
    src = srcs[0]
    arr = src.read(window=window)
    arr = to_math_type(arr)

    for func in parse_operations(args["ops_string"]):
        arr = func(arr)

    # scaled 0 to 1, now scale to outtype
    return scale_dtype(arr, args["out_dtype"])
394459
function Colorizer() {
    "use strict";
    /*eslint no-multi-spaces:0*/
    var options    = { bold: 1, underscore: 4, blink: 5, reverse: 7, conceal: 8 };
    var foreground = { black: 30, red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, white: 37 };
    var background = { black: 40, red: 41, green: 42, yellow: 43, blue: 44, magenta: 45, cyan: 46, white: 47 };
    var styles     = {
        'ERROR':     { bg: 'red', fg: 'white', bold: true },
        'INFO':      { fg: 'green', bold: true },
        'TRACE':     { fg: 'green', bold: true },
        'PARAMETER': { fg: 'cyan' },
        'COMMENT':   { fg: 'yellow' },
        'WARNING':   { fg: 'red', bold: true },
        'GREEN_BAR': { fg: 'white', bg: 'green', bold: true },
        'RED_BAR':   { fg: 'white', bg: 'red', bold: true },
        'INFO_BAR':  { bg: 'cyan', fg: 'white', bold: true },
        'WARN_BAR':  { bg: 'yellow', fg: 'white', bold: true },
        'SKIP':      { fg: 'magenta', bold: true },
        'SKIP_BAR':  { bg: 'magenta', fg: 'white', bold: true }
    };

    /**
     * Adds a style to provided text.
     *
     * @param   String  text
     * @param   String  styleName
     * @return  String
     */
    this.colorize = function colorize(text, styleName, pad) {
        if ((fs.isWindows() && (!env['ANSICON'] && env['ConEmuANSI'] !== 'ON')) || !(styleName in styles)) {
            return text;
        }
        return this.format(text, styles[styleName], pad);
    };

    /**
     * Formats a text using a style declaration object.
     *
     * @param  String  text
     * @param  Object  style
     * @return String
     */
    this.format = function format(text, style, pad) {
        if ((fs.isWindows() && (!env['ANSICON'] && env['ConEmuANSI'] !== 'ON')) || !utils.isObject(style)) {
            return text;
        }
        var codes = [];
        if (style.fg && foreground[style.fg]) {
            codes.push(foreground[style.fg]);
        }
        if (style.bg && background[style.bg]) {
            codes.push(background[style.bg]);
        }
        for (var option in options) {
            if (option in style && style[option] === true) {
                codes.push(options[option]);
            }
        }
        // pad
        if (typeof pad === "number" && text.length < pad) {
            text += new Array(pad - text.length + 1).join(' ');
        }
        return "\u001b[" + codes.join(';') + 'm' + text + "\u001b[0m";
    };
}
887482
function fromLab(l, a, b) {
    var color = create();
    setLab(color, l, a, b);
    return color;
}
1032232
function Color4(r, g, b, a) {
            if (r === void 0) { r = 0; }
            if (g === void 0) { g = 0; }
            if (b === void 0) { b = 0; }
            if (a === void 0) { a = 1; }
            this.r = r;
            this.g = g;
            this.b = b;
            this.a = a;
        }
1096085
function compare(color1, color2, method) {
  var methodName = method || 'CIE76Difference';

  if (undefined === methods[methodName]) {
    throw new Error('Method "' + methodName + '" is unknown. See implemented methods in ./lib/method directory.');
  }

  /** @type Abstract */
  var methodObj = new methods[methodName];

  return methodObj.compare(new HexRgb(color1), new HexRgb(color2));
}
138084
function( c, num, variance ){
            if( arguments.length < 3 ){
                variance = ColorRange.DEFAULT_VARIANCE;
            }
            if( arguments.length === 1 ){
                num = c;
                c = undefined;
            }
            var list = new ColorList();
            for( var i=0; i<num; i++){
                list.add(this.getColor(c, variance));
            }
            return list;
        }
1023990
function log(color, args) {
  if (!globalOptions.verbose) {
    return;
  }

  args = Array.prototype.slice.call(args);
  args.unshift(color);
  args.push(COLOR_RESET);

  console.log.apply(console, args); // eslint-disable-line
}