namespace UI;
use UI\Draw\Color;
interface Colourable
{
public function setBackgroundColor(Color $color): self;
public function getBackgroundColor(): Color;
public function setForegroundColor(Color $color): self;
public function getForegroundColor(): Color;
}
Class UI\Control:
namespace UI;
use UI\Draw\Color;
class Control implements Colourable
{
protected $backgroundColor = 0x000000;
protected $foregroundColor = 0xFFFFFF;
public function setBackgroundColor(Color $color): self
{
$this->backgroundColor = $color;
return $this;
}
public function getBackgroundColor()
{
if (is_int($this->backgroundColor)) {
$this->backgroundColor = new Color($this->backgroundColor);
}
return $this->backgroundColor;
}
public function setForegroundColor(Color $color): self
{
$this->foregroundColor = $color;
return $this;
}
public function getForegroundColor()
{
if (is_int($this->foregroundColor)) {
$this->foregroundColor = new Color($this->foregroundColor);
}
return $this->foregroundColor;
}
}
Class UI\Menu:
namespace UI;
use UI\Draw\Color;
class Menu implements Colourable
{
protected $backgroundColor = 0x000000;
protected $foregroundColor = 0xFFFFFF;
public function setBackgroundColor(Color $color): self
{
$this->backgroundColor = $color;
return $this;
}
public function getBackgroundColor()
{
if (is_int($this->backgroundColor)) {
$this->backgroundColor = new Color($this->backgroundColor);
}
return $this->backgroundColor;
}
public function setForegroundColor(Color $color): self
{
$this->foregroundColor = $color;
return $this;
}
public function getForegroundColor()
{
if (is_int($this->foregroundColor)) {
$this->foregroundColor = new Color($this->foregroundColor);
}
return $this->foregroundColor;
}
}
interface
UI\Colourable
:Class
UI\Control
:Class
UI\Menu
: