◆ __construct()
__construct |
( |
|
$r, |
|
|
|
$g, |
|
|
|
$b |
|
) |
| |
Color constructor.
- Parameters
-
◆ __toString()
- Returns
- string
163 return "Color(red:" . $this->red .
", green:" . $this->green .
", blue:" . $this->blue .
")";
◆ averageColor()
static averageColor |
( |
Color ... |
$colors | ) |
|
|
static |
- Parameters
-
- Returns
- Color
97 foreach($colors as $c){
99 $tg += $c->getGreen();
100 $tb += $c->getBlue();
103 return Color::getRGB($tr / $count, $tg / $count, $tb / $count);
◆ getBlue()
- Returns
- int
142 return (
int) $this->blue;
◆ getColorCode()
- Returns
- int
156 return ($this->red << 16 | $this->green << 8 | $this->blue) & 0xffffff;
◆ getDyeColor()
static getDyeColor |
( |
|
$id | ) |
|
|
static |
- Parameters
-
- Returns
- mixed|Color
112 if(isset(self::$dyeColors[$id])){
113 return clone self::$dyeColors[$id];
◆ getGreen()
- Returns
- int
149 return (
int) $this->green;
◆ getRed()
- Returns
- int
135 return (
int) $this->red;
◆ getRGB()
static getRGB |
( |
|
$r, |
|
|
|
$g, |
|
|
|
$b |
|
) |
| |
|
static |
- Parameters
-
- Returns
- Color
84 return new Color((
int) $r, (
int) $g, (
int) $b);
◆ init()
55 if(self::$dyeColors === null){
56 self::$dyeColors = new \SplFixedArray(16);
57 self::$dyeColors[self::COLOR_DYE_BLACK] =
Color::getRGB(30, 27, 27);
58 self::$dyeColors[self::COLOR_DYE_RED] =
Color::getRGB(179, 49, 44);
59 self::$dyeColors[self::COLOR_DYE_GREEN] =
Color::getRGB(61, 81, 26);
60 self::$dyeColors[self::COLOR_DYE_BROWN] =
Color::getRGB(81, 48, 26);
61 self::$dyeColors[self::COLOR_DYE_BLUE] =
Color::getRGB(37, 49, 146);
62 self::$dyeColors[self::COLOR_DYE_PURPLE] =
Color::getRGB(123, 47, 190);
63 self::$dyeColors[self::COLOR_DYE_CYAN] =
Color::getRGB(40, 118, 151);
64 self::$dyeColors[self::COLOR_DYE_LIGHT_GRAY] =
Color::getRGB(153, 153, 153);
65 self::$dyeColors[self::COLOR_DYE_GRAY] =
Color::getRGB(67, 67, 67);
66 self::$dyeColors[self::COLOR_DYE_PINK] =
Color::getRGB(216, 129, 152);
67 self::$dyeColors[self::COLOR_DYE_LIME] =
Color::getRGB(65, 205, 52);
68 self::$dyeColors[self::COLOR_DYE_YELLOW] =
Color::getRGB(222, 207, 42);
69 self::$dyeColors[self::COLOR_DYE_LIGHT_BLUE] =
Color::getRGB(102, 137, 211);
70 self::$dyeColors[self::COLOR_DYE_MAGENTA] =
Color::getRGB(195, 84, 205);
71 self::$dyeColors[self::COLOR_DYE_ORANGE] =
Color::getRGB(235, 136, 68);
72 self::$dyeColors[self::COLOR_DYE_WHITE] =
Color::getRGB(240, 240, 240);
◆ $dyeColors
◆ COLOR_DYE_BLACK
const COLOR_DYE_BLACK = 0 |
◆ COLOR_DYE_BLUE
◆ COLOR_DYE_BROWN
const COLOR_DYE_BROWN = 3 |
◆ COLOR_DYE_CYAN
◆ COLOR_DYE_GRAY
◆ COLOR_DYE_GREEN
const COLOR_DYE_GREEN = 2 |
◆ COLOR_DYE_LIGHT_BLUE
const COLOR_DYE_LIGHT_BLUE = 12 |
◆ COLOR_DYE_LIGHT_GRAY
const COLOR_DYE_LIGHT_GRAY = 7 |
◆ COLOR_DYE_LIME
const COLOR_DYE_LIME = 10 |
◆ COLOR_DYE_MAGENTA
const COLOR_DYE_MAGENTA = 13 |
◆ COLOR_DYE_ORANGE
const COLOR_DYE_ORANGE = 14 |
◆ COLOR_DYE_PINK
◆ COLOR_DYE_PURPLE
const COLOR_DYE_PURPLE = 5 |
◆ COLOR_DYE_RED
◆ COLOR_DYE_WHITE
const COLOR_DYE_WHITE = 15 |
◆ COLOR_DYE_YELLOW
const COLOR_DYE_YELLOW = 11 |
The documentation for this class was generated from the following file:
- src/pocketmine/utils/Color.php