Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Mention supported hex colors#14494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
OskarStark merged 1 commit intosymfony:5.xfromfreezy-sk:console-coloring
Oct 30, 2020
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletionsconsole/coloring.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,13 +40,22 @@ It is possible to define your own styles using the
use Symfony\Component\Console\Formatter\OutputFormatterStyle;

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

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

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

.. versionadded:: 5.2

True (hex) color support was introduced in Symfony 5.2

.. note::

If the terminal doesn't support true colors, the nearest named color is used.
E.g. ``#c0392b`` is degraded to ``red`` or ``#f1c40f`` is degraded to ``yellow``.

And available options are: ``bold``, ``underscore``, ``blink``, ``reverse``
(enables the "reverse video" mode where the background and foreground colors
Expand All@@ -59,6 +68,9 @@ You can also set these colors and options directly inside the tag name::
// green text
$output->writeln('<fg=green>foo</>');

// red text
$output->writeln('<fg=#c0392b>foo</>');

// black text on a cyan background
$output->writeln('<fg=black;bg=cyan>foo</>');

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp