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