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