Get the intepolated colour at the given location on the gradient

@param p The point of the gradient (0 >= n >= 1)
@return The interpolated colour at the given location
162333
public Color getColorAt(float p) {
		if (p <= 0) {
			return ((Step) steps.get(0)).col;
		}
		if (p > 1) {
			return ((Step) steps.get(steps.size()-1)).col;
		}
		
		for (int i=1;i<steps.size();i++) {
			Step prev = ((Step) steps.get(i-1));
			Step current = ((Step) steps.get(i));
			
			if (p <= current.location) {
				float dis = current.location - prev.location;
				p -= prev.location;
				float v = p / dis;
				
				Color c = new Color(1,1,1,1);
				c.a = (prev.col.a * (1 - v)) + (current.col.a * (v));
				c.r = (prev.col.r * (1 - v)) + (current.col.r * (v));
				c.g = (prev.col.g * (1 - v)) + (current.col.g * (v));
				c.b = (prev.col.b * (1 - v)) + (current.col.b * (v));
				
				return c;
			}
		}

		// shouldn't ever happen
		return Color.black;
	}
333087
public void setPaletteRes(@ColorRes int primeId, @ColorRes int extraId) {
        this.primeColor = ContextCompat.getColor(getContext(), primeId);
        this.extraColor = ContextCompat.getColor(getContext(), extraId);
        pathPaint.setColor(primeColor);
        gradient = null;
    }
815008
public Color getColorFor( double value ) {
        if (value <= min) {
            return colors[0];
        } else if (value >= max) {
            return colors[colors.length - 1];
        } else {
            for( int i = 1; i < colors.length; i++ ) {
                double v1 = values[i - 1];
                double v2 = values[i];
                if (value < v2) {

                    double v = (value - v1) / (v2 - v1);
                    Color interpolateColor = interpolateColor(colors[i - 1], colors[i], (float) v);
                    return interpolateColor;
                }
            }
            return colors[colors.length - 1];
        }
    }
1206307
private Drawable getIcon(@ColorRes int colorId) {
        Drawable icon = ContextCompat.getDrawable(this, R.drawable.ic_place_white_24dp);
        if (icon == null) {
            throw new NullPointerException();
        }
        icon = DrawableCompat.wrap(icon);
        DrawableCompat.setTint(icon, ContextCompat.getColor(this, colorId));
        return icon;
    }
1201554
public double dot(Point p)
	{
		return (x * p.x) + (y * p.y) + (z * p.z);
	}
936118
public void interpolateColorValue( ByteBuffer cmapBuffer, float cell ) {
        cmapBuffer.put(Float.isNaN(cell) ? blank : getColor(cell));
    }
1036392
public static MattePainter getMattePainter(final int width, final int height,
		final float[] fractions, final Color... colors)
	{
		final LinearGradientPaint gradientPaint = new LinearGradientPaint(0.0f, 0.0f, width, height,
			fractions, colors);
		final MattePainter mattePainter = new MattePainter(gradientPaint);
		return mattePainter;

	}
3789
public GVRBitmapTexture getSolidColorTexture(int color) {
        GVRBitmapTexture texture;
        synchronized (mColorTextureCache) {
            texture = mColorTextureCache.get(color);
            Log.d(TAG, "getSolidColorTexture(): have cached texture for 0x%08X: %b", color, texture != null);
            if (texture == null) {
                texture = new ImmutableBitmapTexture(mContext, makeSolidColorBitmap(color));
                Log.d(TAG, "getSolidColorTexture(): caching texture for 0x%08X", color);
                mColorTextureCache.put(color, texture);
                Log.d(TAG, "getSolidColorTexture(): succeeded caching for 0x%08X: %b",
                        color, mColorTextureCache.indexOfKey(color) >= 0);
            }
        }

        return texture;
    }
466045
function _getNextColorPair() {
  const indexPair = [colorPairIndex];

  if (colorPairIndex < distinctColors.length - 1) {
    colorPairIndex++;
    indexPair.push(colorPairIndex);
  } else {
    colorPairIndex = 0;
    indexPair.push(colorPairIndex);
  }

  return indexPair;
}
566499
private function hueToPoint(float $p, float $q, float $t): float
    {
        if ($t < 0) {
            $t += 1;
        }

        if ($t > 1) {
            $t -= 1;
        }

        switch (true) {
            case $t < 1 / 6:
                return $p + ($q - $p) * 6 * $t;

            case $t < 1 / 2:
                return $q;

            case $t < 2 / 3:
                return $p + ($q - $p) * (2 / 3 - $t) * 6;
        }

        return $p;
    }
1005294
function(curve, location, distance) {
		var p = _pointAlongPath(curve, location, distance);
		if (p.location > 1) p.location = 1;
		if (p.location < 0) p.location = 0;
		return _gradientAtPoint(curve, p.location);
	}
805609
@ColorInt
    public static int getAlphaColor(@ColorInt int color, @IntRange(from = 0, to = 255) int alpha) {
        int red = Color.red(color);
        int green = Color.green(color);
        int blue = Color.blue(color);
        return Color.argb(alpha, red, green, blue);
    }
869286
def interpolate_colors(colors, flat=False, num_colors=256):
    

    palette = []

    for i in range(num_colors):
        index = (i * (len(colors) - 1)) / (num_colors - 1.0)
        index_int = int(index)
        alpha = index - float(index_int)

        if alpha > 0:
            r = (1.0 - alpha) * colors[index_int][
                0] + alpha * colors[index_int + 1][0]
            g = (1.0 - alpha) * colors[index_int][
                1] + alpha * colors[index_int + 1][1]
            b = (1.0 - alpha) * colors[index_int][
                2] + alpha * colors[index_int + 1][2]
        else:
            r = (1.0 - alpha) * colors[index_int][0]
            g = (1.0 - alpha) * colors[index_int][1]
            b = (1.0 - alpha) * colors[index_int][2]

        if flat:
            palette.extend((int(r), int(g), int(b)))
        else:
            palette.append((int(r), int(g), int(b)))

    return palette
1022312
public int getColor(float v) {
/*
		v *= 255;
		int n = (int)v;
		float f = v-n;
		if (n < 0)
			return map[0];
		else if (n >= 255)
			return map[255];
		return ImageMath.mixColors(f, map[n], map[n+1]);
*/
		int n = (int)(v*255);
		if (n < 0)
			n = 0;
		else if (n > 255)
			n = 255;
		return map[n];
	}
469191
public static Colour attemptToGetAsColour(String part)
    {
        String target = part.toUpperCase();
        for (int i = 0; i < Colour.values().length; i++)
        {
            String col = Colour.values()[i].name().replace("_",  "");
            if (col.equals(target))
                return Colour.values()[i];
        }
        return null;
    }
39616
public void setPatternFill(PdfPatternPainter p, Color color) {
        if (ExtendedColor.getType(color) == ExtendedColor.TYPE_SEPARATION)
            setPatternFill(p, color, ((SpotColor)color).getTint());
        else
            setPatternFill(p, color, 0);
    }
608687
private static Color getColor(String colorString) {

		Color color = null;

		String[] colorParts = colorString.split(",");

		try {

			switch (colorParts.length) {

			case 1:
				Field field = Color.class.getField(colorString);
				color = (Color) field.get(null);
				break;

			case 3:
				color = new Color(Integer.parseInt(colorParts[0]),
						Integer.parseInt(colorParts[1]),
						Integer.parseInt(colorParts[2]));
				break;

			case 4:
				color = new Color(Integer.parseInt(colorParts[0]),
						Integer.parseInt(colorParts[1]),
						Integer.parseInt(colorParts[2]),
						Integer.parseInt(colorParts[3]));
				break;

			default:
				throw new GeoPackageException("Unexpected color arguments: "
						+ colorParts.length + ", color: " + colorString);
			}

		} catch (Exception e) {
			throw new GeoPackageException("Invalid color: " + colorString
					+ ", Allowable Formats: colorName | r,g,b | r,g,b,a", e);
		}

		return color;
	}