A versatile Bash script to print text in true color (24-bit) directly in your terminal, specified by HEX or RGB values. Includes options for generating color shades and complementary colors.
- Make the script executable:
chmod +x colorize
- Move it to a directory in your PATH:
sudo mv colorize /usr/local/bin/
colorize [options] [<text...>] <color>
-s,--shades: Display the color, plus 5 darker and 5 lighter shades.-c,--complementary: Display the complementary color.-cs,-sc: Enable both shades and complementary modes.-t,--text <string>: Specify the text to color. Overrides positional text.
Basic Usage
# Using a HEX color
colorize 'Hello, World!' '#4285F4'
# Using an RGB color
colorize 'This is red.' '255,0,0'Generate Shades
# Get 11 shades of a color using the default text
colorize -s ff7f50Show Complementary Color
colorize --complementary 'Base and Complement' '008080'Combine Shades & Complementary
colorize -cs 'All the colors!' 4B0082Specify Text with a Flag
colorize -s --text "My text here" C51077