Skip to content

Commit a35bab8

Browse files
committed
versionadded and another example
1 parent f43062a commit a35bab8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

console/coloring.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,18 @@ It is possible to define your own styles using the
4040
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
4141

4242
// ...
43-
$outputStyle = new OutputFormatterStyle('#F00', 'yellow', ['bold', 'blink']);
43+
$outputStyle = new OutputFormatterStyle('red', '#ff0', ['bold', 'blink']);
4444
$output->getFormatter()->setStyle('fire', $outputStyle);
4545

4646
$output->writeln('<fire>foo</>');
4747

4848
Any hex color is supported for foreground and background colors. Besides that, these named colors are supported:
4949
``black``, ``red``, ``green``, ``yellow``, ``blue``, ``magenta``, ``cyan`` and ``white``.
5050

51+
.. versionadded:: 5.2
52+
53+
True (hex) color support was introduced in Symfony 5.2
54+
5155
.. note::
5256

5357
If the terminal doesn't support true colors, the nearest named color is used.
@@ -64,6 +68,9 @@ You can also set these colors and options directly inside the tag name::
6468
// green text
6569
$output->writeln('<fg=green>foo</>');
6670

71+
// red text
72+
$output->writeln('<fg=#c0392b>foo</>');
73+
6774
// black text on a cyan background
6875
$output->writeln('<fg=black;bg=cyan>foo</>');
6976

0 commit comments

Comments
 (0)