### Install TTY::Color CLI Source: https://context7.com/piotrmurach/tty-color-cli/llms.txt Instructions for installing the TTY::Color CLI gem using RubyGems or Bundler. This is the first step to using the tool. ```bash # Install directly via RubyGems gem install tty-color-cli # Or add to Gemfile gem "tty-color-cli" # Then run bundler bundle install ``` -------------------------------- ### Install TTY::Color CLI Gem Source: https://github.com/piotrmurach/tty-color-cli/blob/master/README.md Instructions for installing the tty-color-cli gem using Bundler or directly via the gem command. This makes the CLI tool available in your environment. ```ruby gem "tty-color-cli" ``` ```bash $ bundle ``` ```bash $ gem install tty-color-cli ``` -------------------------------- ### Display TTY::Color CLI Help Information Source: https://github.com/piotrmurach/tty-color-cli/blob/master/README.md Demonstrates how to display the help message for the TTY::Color CLI tool. This is useful for understanding available commands and options. ```bash $ tty-color --help ``` -------------------------------- ### Display TTY::Color CLI Version Source: https://context7.com/piotrmurach/tty-color-cli/llms.txt Prints the current version of the tty-color-cli tool and the underlying tty-color library. ```bash tty-color --version # Output: 0.3.0 (tty-color 0.5.x) ``` -------------------------------- ### Check Terminal Color Support with TTY::Color CLI Source: https://github.com/piotrmurach/tty-color-cli/blob/master/README.md Shows how to check if the current terminal supports colors using the TTY::Color CLI. It can be run without arguments or with explicit support flags. ```bash tty-color ``` ```bash tty-color -s ``` ```bash tty-color --support ``` -------------------------------- ### Check Supported Color Mode with TTY::Color CLI Source: https://github.com/piotrmurach/tty-color-cli/blob/master/README.md Illustrates how to check the number of colors supported by the terminal using the TTY::Color CLI. This is done using the `--mode` or `-m` flags. ```bash tty-color -m ``` ```bash tty-color --mode ``` -------------------------------- ### Enable Debug Mode for TTY::Color CLI Source: https://context7.com/piotrmurach/tty-color-cli/llms.txt Activates verbose output to show how color detection was determined. Useful for troubleshooting. Can be combined with other options like --mode or --support. ```bash # Run with debug output tty-color --debug --mode # Output: 256 (with additional debug information to stderr) # Combine with support check tty-color -d -s # Output: true (with debug details) ``` -------------------------------- ### TTY::Color CLI Exit Codes for Scripting Source: https://context7.com/piotrmurach/tty-color-cli/llms.txt Demonstrates the use of standard exit codes (0 for success, 1 for errors) for integrating TTY::Color CLI into shell scripts and conditionals. ```bash # Successful execution returns 0 tty-color --support echo $? # Output: 0 # Invalid options return 1 tty-color --unknown 2>/dev/null echo $? # Output: 1 # Use in shell conditionals if tty-color --support > /dev/null 2>&1; then echo "Command executed successfully" fi ``` -------------------------------- ### Check Terminal Color Support Source: https://context7.com/piotrmurach/tty-color-cli/llms.txt Queries whether the terminal supports colors. Returns 'true' or 'false'. This is the default action and can be used in shell scripts to conditionally apply color. ```bash # Check if terminal supports colors tty-color --support # Output: true # Short form tty-color -s # Output: true # Use in shell scripts for conditional coloring if [ "$(tty-color -s)" = "true" ]; then echo -e "\033[32mColors are supported!\033[0m" else echo "Colors are not supported" fi ``` -------------------------------- ### Check Terminal Color Mode Source: https://context7.com/piotrmurach/tty-color-cli/llms.txt Determines the maximum number of colors the terminal can display (e.g., 8, 16, 256, 16777216). Useful for selecting color palettes in scripts. ```bash # Check number of supported colors tty-color --mode # Output: 256 # Short form tty-color -m # Output: 256 # Use in scripts to select appropriate color palette COLORS=$(tty-color -m) if [ "$COLORS" -ge 256 ]; then echo "Using 256-color palette" elif [ "$COLORS" -ge 16 ]; then echo "Using 16-color palette" else echo "Using basic 8-color palette" fi ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.