Returns maximum number of shades.

@param   {Array} colors
@returns {Number}
330941
function getMaxShades(colors) {
  var max = 0;
  var colorGroups = getColorGroups(colors);

  colorGroups.forEach(function (colorGroup, colorGroupIndex) {
    // Gets colors that belong to group.
    var groupColors = colors.filter(function (o) {
      return o.group === colorGroup;
    });

    var len = groupColors.length;

    if (len > max) {
      max = len;
    }
  });

  return max;
}
889598
function contrast(color) {
    const rgb = [parseInt(color.substring(1, 3), 16),
      parseInt(color.substring(3, 5), 16),
      parseInt(color.substring(5, 7), 16)];
    for (let i = 0; i < 3; i++) {
      rgb[i] = 255 - rgb[i];
    }
    return `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`;
  }
1222972
static int darker(int color, float factor) {
    return Color.argb(Color.alpha(color), Math.max((int) (Color.red(color) * factor), 0),
        Math.max((int) (Color.green(color) * factor), 0), Math.max((int) (Color.blue(color) * factor), 0));
  }
986979
private float brightness(int color) {
        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;

        int V = Math.max(b, Math.max(r, g));
        return (V / 255.f);
    }
212946
function shadeColor(col, amount) {
  let col1rgb = parseColor(col);
  return RGBobj2string({
    r: Math.min(255, col1rgb.r * amount + 0 * Math.max(0,1-amount)),
    g: Math.min(255, col1rgb.g * amount + 0 * Math.max(0,1-amount)),
    b: Math.min(255, col1rgb.b * amount + 0 * Math.max(0,1-amount)),
    a: col1rgb.a
  });
}
477649
function initColors() {
	var low, high,
	    result = new Uint8Array( 0x1000000 );

	for ( low = 0; low < 0x100; low++ ) {
		for ( high = 0; high < 0x100; high++ ) {
			addTile( low, high );
		}
	}

	return result;

	function addTile( low, high ) {
		var colorLow, colorHigh, color,
		    offset = ( low << 16 ) | ( high << 8 );

		for ( var i = 0; i < 8; i++ ) {
			colorLow = ( low & 1 );
	    	colorHigh = ( high & 1 ) << 1;
	    	color = ( colorHigh | colorLow );

			result[ offset + i ] = color;

			low >>= 1;
	    	high >>= 1;
		}
	}
}
1075973
def colorize(occurence,maxoccurence,minoccurence):
    ''''''
    if occurence == maxoccurence:
        color = (255,0,0)
    elif occurence == minoccurence:
        color = (0,0,255)
    else:
        color = (int((float(occurence)/maxoccurence*255)),0,int(float(minoccurence)/occurence*255))
    return color
433430
def _rgb_to_rgbw(color):
        
        # Get the maximum between R, G, and B
        max_value = max(color)

        # If the maximum value is 0, immediately return pure black.
        if max_value == 0:
            return [0] * 4

        # Figure out what the color with 100% hue is
        multiplier = 255 / max_value
        hue_red = color.R * multiplier
        hue_green = color.G * multiplier
        hue_blue = color.B * multiplier

        # Calculate the whiteness (not strictly speaking luminance)
        max_hue = max(hue_red, hue_green, hue_blue)
        min_hue = min(hue_red, hue_green, hue_blue)
        luminance = ((max_hue + min_hue) / 2 - 127.5) * 2 / multiplier

        # Calculate the output values
        r = max(0, min(255, int(color.R - luminance)))
        g = max(0, min(255, int(color.G - luminance)))
        b = max(0, min(255, int(color.B - luminance)))
        w = max(0, min(255, int(luminance)))

        return [r, g, b, w]
758395
function(color1, color2) {
		var result = color1.slice();
		for (var i=0;i<3;i++) {
			for (var j=1;j<arguments.length;j++) {
				result[i] += arguments[j][i];
			}
		}
		return result;
	}
556178
def color(self, n):
        
        red = int(n * self.shade_factor)
        if (red > 255):
            red = 255
        return (red, 50, 100)
339710
function(color1, color2) {
		for (var i=0;i<3;i++) {
			for (var j=1;j<arguments.length;j++) {
				color1[i] *= arguments[j][i] / 255;
			}
			color1[i] = Math.round(color1[i]);
		}
		return color1;
	}
990702
function ( color ) {
		var digits, red, green, blue, result, i, nth;

		if ( color.charAt( 0 ) === "#" ) {
		    result = color;
		}
		else {
			digits = string.explode( color.replace( /.*\(|\)/g, "" ) );
			red    = number.parse( digits[0] || 0 );
			green  = number.parse( digits[1] || 0 );
			blue   = number.parse( digits[2] || 0 );
			result = ( blue | ( green << 8 ) | ( red << 16 ) ).toString( 16 );

			if ( result.length < 6 ) {
				nth = number.diff( result.length, 6 );
				i   = -1;

				while ( ++i < nth ) {
					result = "0" + result;
				}
			}

			result = "#" + result;
		}

		return result;
	}
702410
function getHueDifference(value) {
    return hues.reduce(function (min, hue) {
      var diff = Math.abs(hue - value);
      if (diff < min) {
        return diff;
      }
      return min;
    }, Infinity);
  }
446849
function (color) {
            if (color instanceof me.Color) {
                this.glArray.set(color.glArray);
                return this;
            }

            return this.parseCSS(color);
        }
780132
function getFocusColor(colors) {
  if (Color(colors.primary).luminosity() >= 0.8) {
    return colors.accent;
  }

  return colors.primary;
}
1262138
function(opt_randFunc) {
    var randFunc = opt_randFunc || randInt;
    var strong = randFunc(3);
    var colors = [];
    for (var ii = 0; ii < 3; ++ii) {
      colors.push(randFunc(128) + (ii === strong ? 128 : 64));
    }
    return "rgb(" + colors.join(",") + ")";
  }
265530
function ( color, type ) {
            var rgbaObj = this.toRgba( color, true ),
                r = 255 - rgbaObj.r, g = 255 - rgbaObj.g, b = 255 - rgbaObj.b;
            return this.convert( 'rgba(' + r + ',' + g + ',' + b + ',' + rgbaObj.a + ')', type );
        }