Skip to content

feat: add optional colorized output support#1223

Open
penww wants to merge 1 commit intoros2:rollingfrom
penww:feature/colorize
Open

feat: add optional colorized output support#1223
penww wants to merge 1 commit intoros2:rollingfrom
penww:feature/colorize

Conversation

@penww
Copy link
Copy Markdown

@penww penww commented Apr 20, 2026

Description

Fixes #1222

Add ros2cli/color.py with an extensible colorizer framework that wraps sys.stdout and applies ANSI colors line-by-line. Colorizers are registered per (command, verb) pair; unregistered commands fall back to DefaultColorizer.

Colorized output is activated when ROS_COLORIZED_OUTPUT=1 and stdout is a TTY, or via the new --color CLI flag.

ros2color

Is this user-facing behavior change?

No.

  • No behavioral change when --color is not passed and ROS_COLORIZED_OUTPUT is unset.
  • It only takes effect when stdout is a TTY, so it does not break pipe commands.

Did you use Generative AI?

Yes, partially with Claude Sonnet 4.6

Additional Information

@penww penww force-pushed the feature/colorize branch from f1130bc to 885f419 Compare April 20, 2026 02:31
Add ros2cli/color.py with an extensible colorizer framework that wraps
sys.stdout and applies ANSI colors line-by-line. Colorizers are
registered per (command, verb) pair; unregistered commands fall back to
DefaultColorizer.

Colorized output is activated when ROS_COLORIZED_OUTPUT=1 and stdout is
a TTY, or via the new --color CLI flag.

Signed-off-by: Peng Wang <penwang@qti.qualcomm.com>
@penww penww force-pushed the feature/colorize branch from 885f419 to aef6481 Compare April 20, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add optional colorized output support

1 participant