Skip to content

Commit 76c03ac

Browse files
alexandre-dauboisjaviereguiluz
authored andcommitted
[Console] Mention Terminal color mode support
1 parent f5c68b3 commit 76c03ac

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

console.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,8 @@ call ``setAutoExit(false)`` on it to get the command result in ``CommandTester``
575575
and extend the normal ``\PHPUnit\Framework\TestCase``.
576576

577577
When testing your commands, it could be useful to understand how your command
578-
reacts on different settings like the width and the height of the terminal.
579-
You have access to such information thanks to the
578+
reacts on different settings like the width and the height of the terminal, or
579+
even the color mode being used. You have access to such information thanks to the
580580
:class:`Symfony\\Component\\Console\\Terminal` class:
581581

582582
use Symfony\Component\Console\Terminal;
@@ -589,6 +589,17 @@ You have access to such information thanks to the
589589
// gets the number of columns available
590590
$width = $terminal->getWidth();
591591

592+
// gets the color mode
593+
$colorMode = $terminal->getColorMode();
594+
595+
// changes the color mode
596+
$colorMode = $terminal->setColorMode(AnsiColorMode::Ansi24);
597+
598+
.. versionadded:: 6.2
599+
600+
The support for setting and getting the current color mode was introduced
601+
in Symfony 6.2.
602+
592603
Logging Command Errors
593604
----------------------
594605

0 commit comments

Comments
 (0)