@@ 201-218 (lines=18) @@ | ||
198 | return $this; |
|
199 | } |
|
200 | ||
201 | public function setBackgroundColour($colour) : self |
|
202 | { |
|
203 | if (is_int($colour)) { |
|
204 | if ($this->terminal->getColourSupport() < 256) { |
|
205 | // Need to fallback to 8 colors |
|
206 | return $this; |
|
207 | } |
|
208 | if ($colour < 0 || $colour > 255) { |
|
209 | throw new Exception("Invalid colour code"); |
|
210 | } |
|
211 | } else { |
|
212 | Assertion::inArray($colour, MenuStyle::getAvailableColours()); |
|
213 | } |
|
214 | ||
215 | $this->style['bg'] = $colour; |
|
216 | ||
217 | return $this; |
|
218 | } |
|
219 | ||
220 | public function setForegroundColour($colour) : self |
|
221 | { |
|
@@ 220-237 (lines=18) @@ | ||
217 | return $this; |
|
218 | } |
|
219 | ||
220 | public function setForegroundColour($colour) : self |
|
221 | { |
|
222 | if (is_int($colour)) { |
|
223 | if ($this->terminal->getColourSupport() < 256) { |
|
224 | // Need to fallback to 8 colors |
|
225 | return $this; |
|
226 | } |
|
227 | if ($colour < 0 || $colour > 255) { |
|
228 | throw new Exception("Invalid colour code"); |
|
229 | } |
|
230 | } else { |
|
231 | Assertion::inArray($colour, MenuStyle::getAvailableColours()); |
|
232 | } |
|
233 | ||
234 | $this->style['fg'] = $colour; |
|
235 | ||
236 | return $this; |
|
237 | } |
|
238 | ||
239 | public function setWidth(int $width) : self |
|
240 | { |