You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue adds optional colorized terminal output to ros2cli. Colorization is off by default and can be enabled in two ways:
Set the environment variable ROS_COLORIZED_OUTPUT=1 (requires stdout to be a TTY)
Pass the --color flag on the command line (e.g. ros2 --color topic echo /chatter)
Motivation
ros2cli output — especially from commands like ros2 topic echo, ros2 interface show, and ros2 param dump — is often dense, structured text (YAML, IDL, key-value pairs). Without color, it is difficult to quickly distinguish field names from values, ROS type strings from plain text, or section headers from content. Colorized output is a standard ergonomic feature in modern CLI tools and has been a recurring community request.
Design / Implementation Considerations
Modified: ros2cli/cli.py
Adds --color CLI argument
Activates ColoringStdout wrapping when color is enabled, selecting the appropriate colorizer for the active command/verb
New file: ros2cli/color.py
Introduces a Colorizer base class and an extensible registry keyed by (command, verb) pairs
DefaultColorizer applies generic ANSI heuristics (ROS paths, type strings, YAML keys) as a fallback for unregistered commands
ColoringStdout wraps sys.stdout and colorizes output line-by-line
Have you colorized Gazebo sim output as well, its just mess, e.g: if you have multiple nodes launched with a launch file?
@PrabodhGyawali Thanks for your feedback😁. I think that case is related, but slightly different from the scope here.
The Gazebo / multi-node launch output is mostly runtime process output managed by ros2 launch / launch, where stdout and stderr from multiple processes are interleaved. This issue is focused on colorizing structured ros2cli command output, such as ros2 node info, ros2 topic echo, ros2 interface show, and parameter output.
I can try to add support for launch/launch_ros output later, but I would like to prioritize finishing the ros2cli command output colorization first.
I have also noticed at times certain nodes may overdo logging, and would be cool as well if there was a way to control how many times certain things get logged, rather coding hacks for it each time, like rather than logging every 10 Hz it would do it every 500 Hz to make visualization of CLI output easier to read.
Would appreciate any recommendations to efficiently deal with this.
Thanks.
@PrabodhGyawali That's a good point. ROS nodes can already achieve this by using the RCLCPP_*_THROTTLE APIs (e.g., RCLCPP_INFO_THROTTLE) to limit log output frequency. However, that requires modifying the node source code, which is not always practical, especially for third-party nodes.
It might be an interesting idea to provide this capability at the ros2 run / ros2 launch level, allowing users to throttle or filter log output without changing the application code.
Activity
PrabodhGyawali commentedon Jun 28, 2026
Have you colorized Gazebo sim output as well, its just mess, e.g: if you have multiple nodes launched with a launch file?
penww commentedon Jul 8, 2026
@PrabodhGyawali Thanks for your feedback😁. I think that case is related, but slightly different from the scope here.
The Gazebo / multi-node launch output is mostly runtime process output managed by
ros2 launch/launch, where stdout and stderr from multiple processes are interleaved. This issue is focused on colorizing structured ros2cli command output, such asros2 node info,ros2 topic echo,ros2 interface show, and parameter output.I can try to add support for launch/launch_ros output later, but I would like to prioritize finishing the ros2cli command output colorization first.
PrabodhGyawali commentedon Jul 8, 2026
No worries, thanks for the reply.
I am currently using tmux scripts like this: https://gist.github.com/PrabodhGyawali/ff1444eb6042faefe5beabe3d6b0bb50 to launch multiple nodes for better control and visualization.
OUT OF SCOPE Question:
I have also noticed at times certain nodes may overdo logging, and would be cool as well if there was a way to control how many times certain things get logged, rather coding hacks for it each time, like rather than logging every 10 Hz it would do it every 500 Hz to make visualization of CLI output easier to read.
Would appreciate any recommendations to efficiently deal with this.
Thanks.
penww commentedon Jul 10, 2026
@PrabodhGyawali That's a good point. ROS nodes can already achieve this by using the RCLCPP_*_THROTTLE APIs (e.g., RCLCPP_INFO_THROTTLE) to limit log output frequency. However, that requires modifying the node source code, which is not always practical, especially for third-party nodes.
It might be an interesting idea to provide this capability at the ros2 run / ros2 launch level, allowing users to throttle or filter log output without changing the application code.