Skip to content

Commit 08f92d4

Browse files
committed
[console] Adding information about coloring console output
1 parent 5fa647a commit 08f92d4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

cookbook/console.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,24 @@ This prints::
7575

7676
HELLO FABIEN
7777

78+
Coloring the Output
79+
~~~~~~~~~~~~~~~~~~~
80+
81+
Whenever you output text, you can surround the text with tags to color its
82+
output. For example::
83+
84+
// green text
85+
$output->writeln('<info>foo</info>');
86+
87+
// yellow text
88+
$output->writeln('<comment>foo</comment>');
89+
90+
// black text on a cyan background
91+
$output->writeln('<question>foo</question>');
92+
93+
// white text on a red background
94+
$output->writeln('<error>foo</error>');
95+
7896
Using Command Arguments
7997
-----------------------
8098

@@ -164,7 +182,7 @@ to confirm an action before actually executing it. Add the following to your
164182
command::
165183

166184
$dialog = $this->getHelperSet()->get('dialog');
167-
if (!$dialog->askConfirmation($output, 'Continue with this action?', false)) {
185+
if (!$dialog->askConfirmation($output, '<question>Continue with this action?</question>', false)) {
168186
return;
169187
}
170188

0 commit comments

Comments
 (0)