Get the mixed color.

@return Color Returns a new Color object from the Mixer.
973992
public function mix() : Color
    {
        foreach ($this->colors as $color) {
            $colors  = $color->dec();
            $reds  []= $colors[0];
            $greens[]= $colors[1];
            $blues []= $colors[2];
        }

        $red   = dechex( round(array_sum($reds)  / count($reds)  ) );
        $green = dechex( round(array_sum($greens)/ count($greens)) );
        $blue  = dechex( round(array_sum($blues) / count($blues) ) );

        // pad single-digit hexadecimals with leading zero
        foreach ([&$red, &$green, &$blue] as &$color) {
            if (strlen($color) === 1) {
                $color = "0$color";
            }
        }

        return new Color($red.$green.$blue);
    }
242499
public int color(Context ctx, @AttrRes int colorStyle, @ColorRes int colorDefaultRes) {
        //get the color from the holder else from the theme
        int color = color(ctx);
        if (color == 0) {
            return UIUtils.getThemeColorFromAttrOrRes(ctx, colorStyle, colorDefaultRes);
        } else {
            return color;
        }
    }
1144146
@Pure
	public static String toColor(int red, int green, int blue, int alpha) {
		return toColor(encodeRgbaColor(red, green, blue, alpha));
	}
684504
public static Color randomColor(Random random) {
		if (null == random) {
			random = RandomUtil.getRandom();
		}
		return new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
	}
614144
public CMYKColor getComplementaryColor() {
        double[] rgb = CMYKColor.getRGB(cyan, magenta, yellow, black);
        double[] cmyk = CMYKColor.getCMYK(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
        return new CMYKColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
    }
1166276
public String getOnColor() {
		String value = (String) getStateHelper().eval(PropertyKeys.onColor);
		return value;
	}
1307803
protected function mixColors(Color $a, Color $b): Color {
        $alpha = $this->a($b) + (1 - $this->a($b)) * $this->a($a);

        // To avoid divide on zero
        if ($alpha == 0) {
            return new Color(0, 0, 0, 0);
        }

        $k = $this->a($b) / $alpha;

        return new Color(
            $a->r() + ($b->r() - $a->r()) * $k,
            $a->g() + ($b->g() - $a->g()) * $k,
            $a->b() + ($b->b() - $a->b()) * $k,
            $alpha
        );
    }
351835
public HSBColor getComplementaryColor() {
        double[] rgb = HSBColor.getRGB(hue, saturation, brightness);
        double[] hsb = HSBColor.getHSB(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
        return new HSBColor(hsb[0], hsb[1], hsb[2]);
    }
918621
@Override
    public int[] vertexColor() {
        int[] result = colors;
        if (result == null) {
            synchronized (this) {
                result = colors;
                if (result == null) {
                    colors = result = buildVertexColor();
                }
            }
        }
        return result;
    }
910733
public static function randColor() {
        $c = '#';
        $i = 0;
        while ($i++ < 3) {
            $c .= str_pad(dechex(mt_rand(0, 255)), 2, '0', STR_PAD_LEFT);
        }
        return $c;
    }
643960
public function getColour()
    {
        if (null === $this->colour) {
            $this->colour = self::DEFAULT_COLOUR;
        }

        return $this->colour;
    }
570705
public function getMixins()
    {
        if(!isset($this->getConfig()->mixins)) {
            $this->getConfig()->append(array('mixins' => array()));
        }

        return $this->getConfig()->mixins;
    }
627251
public static final Color getColorForValue(double val) {
    // Color positions
    double[] pos = new double[] { 0.0, 0.6, 0.8, 1.0 };
    // Colors at these positions
    Color[] cols = new Color[] { new Color(0.0f, 0.0f, 0.0f, 0.6f), new Color(0.0f, 0.0f, 1.0f, 0.8f), new Color(1.0f, 0.0f, 0.0f, 0.9f), new Color(1.0f, 1.0f, 0.0f, 1.0f) };
    assert (pos.length == cols.length);
    if(val < pos[0]) {
      val = pos[0];
    }
    // Linear interpolation:
    for(int i = 1; i < pos.length; i++) {
      if(val <= pos[i]) {
        Color prev = cols[i - 1];
        Color next = cols[i];
        final double mix = (val - pos[i - 1]) / (pos[i] - pos[i - 1]);
        final int r = (int) ((1 - mix) * prev.getRed() + mix * next.getRed());
        final int g = (int) ((1 - mix) * prev.getGreen() + mix * next.getGreen());
        final int b = (int) ((1 - mix) * prev.getBlue() + mix * next.getBlue());
        final int a = (int) ((1 - mix) * prev.getAlpha() + mix * next.getAlpha());
        Color col = new Color(r, g, b, a);
        return col;
      }
    }
    return cols[cols.length - 1];
  }
239230
private function getDeepColor()
    {
        list($red,$green,$blue) = $this->getRandColor();
        $increase  = 30 + mt_rand(1,254);

        $red = abs(min(255,$red - $increase));
        $green  = abs(min(255,$green - $increase));
        $blue  = abs(min(255,$blue - $increase));

        return [$red,$green,$blue];
    }
148708
public int color(Context ctx) {
        if (mColorInt == 0 && mColorRes != -1) {
            mColorInt = ContextCompat.getColor(ctx, mColorRes);
        }
        return mColorInt;
    }
294225
public function getColour() : ?string 
    {
        if ( ! $this->hasColour()) {
            $this->setColour($this->getDefaultColour());
        }
        return $this->colour;
    }
464660
public static RgbaColor from(String color) {
        if (color.startsWith("#")) {
            return fromHex(color);
        }
        else if (color.startsWith("rgba")) {
            return fromRgba(color);
        }
        else if (color.startsWith("rgb")) {
            return fromRgb(color);
        }
        else if (color.startsWith("hsla")) {
            return fromHsla(color);
        }
        else if (color.startsWith("hsl")) {
            return fromHsl(color);
        }
        else {
            return getDefaultColor();
        }
    }