#!/bin/bash # Test script for UnitForge color utility # This script tests all color functions and displays examples set -e # Load the color utility SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${SCRIPT_DIR}/colors.sh" echo box_header "UnitForge Color Utility Test" echo header "Basic Color Functions" red "This is red text" green "This is green text" yellow "This is yellow text" blue "This is blue text" purple "This is purple text" cyan "This is cyan text" white "This is white text" gray "This is gray text" echo subheader "Bright Colors" bright_red "This is bright red text" bright_green "This is bright green text" bright_yellow "This is bright yellow text" bright_blue "This is bright blue text" bright_purple "This is bright purple text" bright_cyan "This is bright cyan text" bright_white "This is bright white text" echo subheader "Status Messages" info "This is an info message" success "This is a success message" warning "This is a warning message" error "This is an error message" debug "This is a debug message (only shown if DEBUG=1)" echo DEBUG=1 debug "This debug message should be visible" echo subheader "Status Indicators" status ok "Operation completed successfully" status fail "Operation failed" status warn "Operation completed with warnings" status info "Information about the operation" status skip "Operation was skipped" status unknown "Unknown status" echo subheader "Progress Steps" step 1 5 "Initializing project" step 2 5 "Installing dependencies" step 3 5 "Running tests" step 4 5 "Building documentation" step 5 5 "Deployment complete" echo subheader "Box Messages" box_message "Success: Operation completed!" "$GREEN" 50 box_message "Warning: Check configuration" "$YELLOW" 50 box_message "Error: Something went wrong" "$RED" 50 echo subheader "Headers and Formatting" echo "Testing ${BOLD}bold${NC}, ${UNDERLINE}underline${NC}, and ${DIM}dim${NC} text" echo "Testing ${ITALIC}italic${NC} text (if supported by terminal)" echo subheader "Color Support Detection" if supports_color; then success "Terminal supports colors" else warning "Terminal does not support colors (colors disabled)" fi echo subheader "Environment Info" echo "TERM: ${TERM:-not set}" echo "NO_COLOR: ${NO_COLOR:-not set}" echo "Terminal type: $(tty 2>/dev/null || echo 'not a terminal')" echo success "Color utility test completed!" echo