22declare(strict_types=1);
24namespace pocketmine\color;
35 public function __construct(
int $r,
int $g,
int $b,
int $a = 0xff){
45 public function getA() : int{
52 public function getR() : int{
59 public function getG() : int{
66 public function getB() : int{
77 $count = count($colors);
79 $a = $r = $g = $b = 0;
81 foreach($colors as $color){
88 return new Color(intdiv($r, $count), intdiv($g, $count), intdiv($b, $count), intdiv($a, $count));
95 return new
Color(($code >> 16) & 0xff, ($code >> 8) & 0xff, $code & 0xff);
102 return new
Color(($code >> 16) & 0xff, ($code >> 8) & 0xff, $code & 0xff, ($code >> 24) & 0xff);
109 return ($this->a << 24) | ($this->r << 16) | ($this->g << 8) | $this->b;
116 return new
Color(($code >> 24) & 0xff, ($code >> 16) & 0xff, ($code >> 8) & 0xff, $code & 0xff);
123 return ($this->r << 24) | ($this->g << 16) | ($this->b << 8) | $this->a;
129 public function equals(
self $other) : bool{
130 return $this->a === $other->a && $this->r === $other->r && $this->g === $other->g && $this->b === $other->b;
static mix(Color $color1, Color ... $colors)
static fromRGBA(int $code)
static fromRGB(int $code)
static fromARGB(int $code)