| @@ 247-262 (lines=16) @@ | ||
| 244 | return $this->fg; |
|
| 245 | } |
|
| 246 | ||
| 247 | public function setFg($fg) : self |
|
| 248 | { |
|
| 249 | if (is_int($fg)) { |
|
| 250 | if ($this->terminal->getColourSupport() < 256) { |
|
| 251 | // Need to map to 8 colors |
|
| 252 | return $this; |
|
| 253 | } elseif ($fg < 0 || $fg > 255) { |
|
| 254 | throw new Exception("Invalid colour code"); |
|
| 255 | } |
|
| 256 | } |
|
| 257 | ||
| 258 | $this->fg = $fg; |
|
| 259 | $this->generateColoursSetCode(); |
|
| 260 | ||
| 261 | return $this; |
|
| 262 | } |
|
| 263 | ||
| 264 | public function getBg() : string |
|
| 265 | { |
|
| @@ 269-284 (lines=16) @@ | ||
| 266 | return $this->bg; |
|
| 267 | } |
|
| 268 | ||
| 269 | public function setBg($bg) : self |
|
| 270 | { |
|
| 271 | if (is_int($bg)) { |
|
| 272 | if ($this->terminal->getColourSupport() < 256) { |
|
| 273 | // Need to map to 8 colors |
|
| 274 | return $this; |
|
| 275 | } |
|
| 276 | if ($bg < 0 || $bg > 255) { |
|
| 277 | throw new Exception("Invalid colour code"); |
|
| 278 | } |
|
| 279 | } |
|
| 280 | $this->bg = $bg; |
|
| 281 | $this->generateColoursSetCode(); |
|
| 282 | ||
| 283 | return $this; |
|
| 284 | } |
|
| 285 | ||
| 286 | public function getWidth() : int |
|
| 287 | { |
|