Skip to content

Commit 28fac0a

Browse files
authored
colorful output for colcon commands (#25)
* colorful output for colcon commans * Update * fix of command order
1 parent 3e42b65 commit 28fac0a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/10-prerequisities/25-ros2/20-workspace-build.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,29 @@ export ROS_WORKSPACE="$HOME/ws_examples"
9595
Do not put any manual sourcing of the workspace or `/opt/ros/jazzy/` into your `~/.bashrc` (`~/.zshrc`)!
9696
Sourcing `mrs_uav_development` sources the `ROS_WORKSPACE` specified in `~/.bashrc` (`~/.zshrc`) automatically (or it sources `/opt/ros/jazzy` if no `ROS_WORKSPACE` is specified.
9797

98+
### 7. Colorful output for colcon commands
99+
If you're accustomed to the colorful output of catkin_tools from ROS 1, you can achieve a similar look and feel with colcon in ROS 2.
100+
This makes it easier to read build logs and quickly identify important messages or errors.
101+
102+
To get started, install the colcon-ansi-colors-example extension using pip:
103+
```bash
104+
pip install git+https://github.com/cottsay/colcon-ansi-colors-example --break-system-packages
105+
```
106+
Note: The `--break-system-packages` flag is often required to install pip packages globally on systems where the package manager is strict about system files.
107+
108+
Once the extension is installed, you can use the new output style with the following command:
109+
110+
```bash
111+
colcon --output-style catkin_tools build
112+
```
113+
114+
If you like the colorful output and want to use it by default for all colcon commands, add the following line to your shell's configuration file (e.g., `~/.bashrc` for Bash or `~/.zshrc` for Zsh):
115+
```bash
116+
export COLCON_DEFAULT_OUTPUT_STYLE=catkin_tools
117+
```
118+
After adding the line, be sure to open a new terminal or run `source ~/.bashrc` (or the appropriate file) for the change to take effect.
119+
120+
98121

99122
# Troubleshooting
100123

0 commit comments

Comments
 (0)