9 releases (stable)
2.1.0 | Sep 12, 2023 |
---|---|
2.0.0 | Aug 26, 2023 |
1.1.2 | Aug 3, 2021 |
1.1.0 | Jun 24, 2021 |
0.1.0 | Jun 17, 2021 |
#1472 in Command line utilities
9KB
161 lines
Colorizer
Description
Colorizer is a tool for highlighting words in your terminal. It accepts one or more pattern parameters as input and highlights each match in one of the available colors:
- Black
- Red
- Green
- Yellow
- Blue
- Purple
- Cyan
- White
Usage
To see the available options, run:
$ colorizer --help
Installation
You can install Colorizer using the following command:
$ cargo install colorizer
Examples
Example 1
Highlight the word "world" in red:
$ echo "hello world" | colorizer --color red --regex world
Example 2
Highlight words containing the letter "r" in green:
$ echo "hello world" | colorizer --regex "\w+r\w+" --color green
Configuration
On startup, Colorizer checks for a configuration file in the home directory ~/.config/colorizer/config.yml. It allows you to use profiles defined in this file.
Create a configuration file in this directory and use a profile from it via the -p or --profile parameter. If the configuration file exists and Colorizer is launched without specifying a profile name, the "default" profile will be used. Colorizer does not terminate abnormally if the configuration file is not found or if the specified profile does not exist.
Usage Example
If the config file exists, you can use the "my_profile" profile as follows:
$ echo "hello, world!" | colorizer -p my_profile
If the config file exists, the "default" profile will be used if no profile is specified:
echo "hello, world!" | colorizer
Configuration Example
Here's an example of a configuration file in YAML format:
profiles:
default:
red:
- "hello .*"
- "foo"
blue:
- "bar .*"
my_profile:
red:
- ".*"
Enjoy using Colorizer and add some color to your terminal experience!
Dependencies
~4–12MB
~128K SLoC