Calculates the Delta E (CIE2000) of two colors.
197128
def delta_e_cie2000(color1, color2, Kl=1, Kc=1, Kh=1):
    
    color1_vector = _get_lab_color1_vector(color1)
    color2_matrix = _get_lab_color2_matrix(color2)
    delta_e = color_diff_matrix.delta_e_cie2000(
        color1_vector, color2_matrix, Kl=Kl, Kc=Kc, Kh=Kh)[0]
    return numpy.asscalar(delta_e)
81036
def F(self, **kwargs):
        '''
        
        '''
        Eg = self.Eg_Gamma_0(**kwargs)
        Delta_SO = self.Delta_SO(**kwargs)
        Ep = self.Ep(**kwargs)
        meff = self.meff_e_Gamma_0(**kwargs)
        return (1./meff-1-(Ep*(Eg+2.*Delta_SO/3.))/(Eg*(Eg+Delta_SO)))/2
541186
static double luma( double color ) {
        long argb = Double.doubleToRawLongBits( color );
        double r = ((argb >> 32) & 0xFFFF) / (double)0xFF00;
        double g = ((argb >> 16) & 0xFFFF) / (double)0xFF00;
        double b = ((argb) & 0xFFFF) / (double)0xFF00;

        r = (r <= 0.03928) ? r / 12.92 : Math.pow( ((r + 0.055) / 1.055), 2.4 );
        g = (g <= 0.03928) ? g / 12.92 : Math.pow( ((g + 0.055) / 1.055), 2.4 );
        b = (b <= 0.03928) ? b / 12.92 : Math.pow( ((b + 0.055) / 1.055), 2.4 );

        return 0.2126 * r + 0.7152 * g + 0.0722 * b;
    }
786420
function(red, green, blue, model) {
    red = red / 255;
    green = green / 255;
    blue = blue / 255;
    var r = red > 0.04045 ? Math.pow(((red + 0.055) / 1.055), 2.4000000953674316) : red / 12.92;
    var g = green > 0.04045 ? Math.pow(((green + 0.055) / 1.055), 2.4000000953674316) : green / 12.92;
    var b = blue > 0.04045 ? Math.pow(((blue + 0.055) / 1.055), 2.4000000953674316) : blue / 12.92;
    var x = r * 0.664511 + g * 0.154324 + b * 0.162028;
    var y = r * 0.283881 + g * 0.668433 + b * 0.047685;
    var z = r * 8.8E-5 + g * 0.07231 + b * 0.986039;
    var xy = [x / (x + y + z), y / (x + y + z)];
    if (isNaN(xy[0])) {
      xy[0] = 0.0;
    }
    
    if (isNaN(xy[1])) {
      xy[1] = 0.0;
    }
    
    var colorPoints = colorPointsForModel(model);
    var inReachOfLamps = checkPointInLampsReach(xy, colorPoints);
    if (!inReachOfLamps) {
      var pAB = getClosestPointToPoints(colorPoints[0], colorPoints[1], xy);
      var pAC = getClosestPointToPoints(colorPoints[2], colorPoints[0], xy);
      var pBC = getClosestPointToPoints(colorPoints[1], colorPoints[2], xy);
      var dAB = getDistanceBetweenTwoPoints(xy, pAB);
      var dAC = getDistanceBetweenTwoPoints(xy, pAC);
      var dBC = getDistanceBetweenTwoPoints(xy, pBC);
      var lowest = dAB;
      var closestPoint = pAB;
      if (dAC < dAB) {
        lowest = dAC;
        closestPoint = pAC;
      }
      
      if (dBC < lowest) {
        closestPoint = pBC;
      }
      
      xy[0] = closestPoint[0];
      xy[1] = closestPoint[1];
    }
    
    xy[0] = precision(xy[0]);
    xy[1] = precision(xy[1]);
    return xy;
  }
1080498
private void calculateColor(int coord) {
    	    coord = coord - mBarPointerHaloRadius;
    	    if (coord < 0) {
    	    	coord = 0;
    	    } else if (coord > mBarLength) {
    	    	coord = mBarLength;
    	    }

    		mColor = Color.HSVToColor(
    			Math.round(mPosToOpacFactor * coord),
    			mHSVColor);
    		if (Color.alpha(mColor) > 250) {
    		    mColor = Color.HSVToColor(mHSVColor);
    		} else if (Color.alpha(mColor) < 5) {
    		    mColor = Color.TRANSPARENT;
    		}
        }
883836
private void calculateColor(int coord) {
	    coord = coord - mBarPointerHaloRadius;
	    if (coord < 0) {
	    	coord = 0;
	    } else if (coord > mBarLength) {
	    	coord = mBarLength;
	    }
	    mColor = Color.HSVToColor(new float[] { mHSVColor[0],
		    				    mHSVColor[1],
		    				    (float) (1 - (mPosToSatFactor * coord)) });
    }
973483
public static int compare(float a, float b, float delta) {
        if (equals(a, b, delta)) {
            return 0;
        }
        return Float.compare(a, b);
    }
64370
private static int blendColors(int color1, int color2, float ratio) {
    final float inverseRation = 1f - ratio;
    float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation);
    float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation);
    float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation);
    return Color.rgb((int) r, (int) g, (int) b);
  }
66080
def get_color_between(color1, color2, i):
    
    if i <= 0:
        return color1
    if i >= 1:
        return color2
    return (int(color1[0] + (color2[0] - color1[0]) * i),
            int(color1[1] + (color2[1] - color1[1]) * i),
            int(color1[2] + (color2[2] - color1[2]) * i))
1374113
function deltaE(labA, labB) {
      var deltaL = labA[0] - labB[0];
      var deltaA = labA[1] - labB[1];
      var deltaB = labA[2] - labB[2];

      return Math.sqrt(Math.pow(deltaL, 2) +
                       Math.pow(deltaA, 2) +
                       Math.pow(deltaB, 2));
    }
297963
def get_and_subtract(self, delta):
        '''
        
        '''
        with self._reference.get_lock():
            oldval = self._reference.value
            self._reference.value -= delta
            return oldval
550243
private double delta(double y, double bMutationParameter) {
    double rand = randomGenenerator.getRandomValue();
    int it, maxIt;
    it = currentIteration;
    maxIt = maxIterations;

    return (y * (1.0 -
        Math.pow(rand,
            Math.pow((1.0 - it / (double) maxIt), bMutationParameter)
        )));
  }
463058
def hue_similarity( color1, color2 )
      deg1   = color1.to_hsl.h
      deg2   = color2.to_hsl.h
      deg1  += 1 if deg1 < 0
      deg2  += 1 if deg2 < 0
      delta  = (deg1 - deg2).abs
      delta  = 1 - delta if delta > 0.5
      delta * 360
    end
1002652
def interp_color(a, b, f):
    
    a_ = (a.redF(), a.greenF(), a.blueF())
    b_ = (b.redF(), b.greenF(), b.blueF())
    a_ = [x * (1 - f) for x in a_]
    b_ = [x * f for x in b_]
    c = [x + y for x, y in zip(a_, b_)]
    return QtGui.QColor.fromRgbF(*c)
166040
def _t_of_e(self, a0=None, t_start=None, f0=None, ef=None, t_obs=5.0):
        
        if ef is None:
            ef = np.ones_like(self.e0)*0.0000001

        beta = 64.0/5.0*self.m1*self.m2*(self.m1+self.m2)

        e_vals = np.asarray([np.linspace(ef[i], self.e0[i], self.num_points)
                            for i in range(len(self.e0))])
        integrand = self._find_integrand(e_vals)
        integral = np.asarray([np.trapz(integrand[:, i:], x=e_vals[:, i:])
                              for i in range(e_vals.shape[1])]).T

        if a0 is None and f0 is None:

            a0 = (19./12.*t_start*beta*1/integral[:, 0])**(1./4.) * self._f_e(e_vals[:, -1])

        elif a0 is None:
            a0 = ((self.m1 + self.m2)/self.f0**2)**(1./3.)

        c0 = self._c0_func(a0, self.e0)

        a_vals = c0[:, np.newaxis]*self._f_e(e_vals)

        delta_t = 12./19*c0[:, np.newaxis]**4/beta[:, np.newaxis]*integral

        return e_vals, a_vals, delta_t
52398
function(color1, color2, amount) {
    var p = amount / 100.0;
    var w = p * 2 - 1;
    var hsl1 = this.toHSL(color1);
    var hsl2 = this.toHSL(color2);
    var a = hsl1.a - hsl2.a;

    var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
    var w2 = 1 - w1;

    var rgb = [
        color1[0] * w1 + color2[0] * w2,
        color1[1] * w1 + color2[1] * w2,
        color1[2] * w1 + color2[2] * w2
    ];

    var alpha = color1[3] * p + color2[3] * (1 - p);
    rgb[3] = alpha;
    return rgb;
  }
1034139
function rgb2hsl() {
    const
        R = this.R,
        G = this.G,
        B = this.B,
        min = Math.min( R, G, B ),
        max = Math.max( R, G, B ),
        delta = max - min;

    this.L = 0.5 * ( max + min );

    if ( delta < 0.000001 ) {
        this.H = 0;
        this.S = 0;
    } else {
        this.S = delta / ( 1 - Math.abs( ( 2 * this.L ) - 1 ) );
        if ( max === R ) {
            if ( G >= B ) {
                this.H = INV6 * ( ( G - B ) / delta );
            } else {
                this.H = 1 - ( INV6 * ( ( B - G ) / delta ) );
            }
        } else if ( max === G ) {
            this.H = INV6 * ( 2 + ( ( B - R ) / delta ) );
        } else {
            this.H = INV6 * ( 4 + ( ( R - G ) / delta ) );
        }
    }
}