| @@ 260-274 (lines=15) @@ | ||
| 257 | return $this->fg; |
|
| 258 | } |
|
| 259 | ||
| 260 | public function setFg($fg, string $fallback = null) : self |
|
| 261 | { |
|
| 262 | if (is_int($fg)) { |
|
| 263 | if ($this->terminal->getColourSupport() < 256) { |
|
| 264 | $fg = $fallback; |
|
| 265 | } elseif ($fg < 0 || $fg > 255) { |
|
| 266 | throw new \Exception("Invalid colour code"); |
|
| 267 | } |
|
| 268 | } |
|
| 269 | ||
| 270 | $this->fg = $fg; |
|
| 271 | $this->generateColoursSetCode(); |
|
| 272 | ||
| 273 | return $this; |
|
| 274 | } |
|
| 275 | ||
| 276 | public function getBg() : string |
|
| 277 | { |
|
| @@ 281-294 (lines=14) @@ | ||
| 278 | return $this->bg; |
|
| 279 | } |
|
| 280 | ||
| 281 | public function setBg($bg, string $fallback = null) : self |
|
| 282 | { |
|
| 283 | if (is_int($bg)) { |
|
| 284 | if ($this->terminal->getColourSupport() < 256) { |
|
| 285 | $bg = $fallback; |
|
| 286 | } elseif ($bg < 0 || $bg > 255) { |
|
| 287 | throw new \Exception("Invalid colour code"); |
|
| 288 | } |
|
| 289 | } |
|
| 290 | $this->bg = $bg; |
|
| 291 | $this->generateColoursSetCode(); |
|
| 292 | ||
| 293 | return $this; |
|
| 294 | } |
|
| 295 | ||
| 296 | public function getWidth() : int |
|
| 297 | { |
|