mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 10:16:01 +08:00
92 lines
1.7 KiB
Bash
92 lines
1.7 KiB
Bash
#!/bin/bash
|
|
# Bash color and formatting utilities
|
|
# Source this file in your bash scripts for colored output
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[0;33m'
|
|
BLUE='\033[0;34m'
|
|
MAGENTA='\033[0;35m'
|
|
CYAN='\033[0;36m'
|
|
WHITE='\033[0;37m'
|
|
GRAY='\033[0;90m'
|
|
|
|
# Bright colors
|
|
BRIGHT_RED='\033[0;91m'
|
|
BRIGHT_GREEN='\033[0;92m'
|
|
BRIGHT_YELLOW='\033[0;93m'
|
|
BRIGHT_BLUE='\033[0;94m'
|
|
BRIGHT_MAGENTA='\033[0;95m'
|
|
BRIGHT_CYAN='\033[0;96m'
|
|
BRIGHT_WHITE='\033[0;97m'
|
|
|
|
# Background colors
|
|
BG_RED='\033[41m'
|
|
BG_GREEN='\033[42m'
|
|
BG_YELLOW='\033[43m'
|
|
BG_BLUE='\033[44m'
|
|
BG_MAGENTA='\033[45m'
|
|
BG_CYAN='\033[46m'
|
|
BG_WHITE='\033[47m'
|
|
|
|
# Text styles
|
|
BOLD='\033[1m'
|
|
DIM='\033[2m'
|
|
UNDERLINE='\033[4m'
|
|
BLINK='\033[5m'
|
|
REVERSE='\033[7m'
|
|
STRIKETHROUGH='\033[9m'
|
|
|
|
# Reset
|
|
NC='\033[0m' # No Color
|
|
|
|
# Design principles:
|
|
# 1. Minimal visual noise - use color sparingly for emphasis
|
|
# 2. Clear hierarchy - different levels of information have different treatments
|
|
# 3. Consistent spacing - clean vertical rhythm
|
|
# 4. Accessible - readable without colors
|
|
|
|
# Main header for script/tool name
|
|
log_title() {
|
|
echo -e "${GREEN}${BOLD}$1${NC}"
|
|
}
|
|
|
|
|
|
# Individual actions/steps - inline result format
|
|
log_action() {
|
|
echo -n " $1... "
|
|
}
|
|
|
|
# Results - success/failure/info (on same line)
|
|
log_ok() {
|
|
echo -e "${GREEN}✓${NC}"
|
|
}
|
|
|
|
log_fail() {
|
|
echo -e "${RED}✗${NC}"
|
|
}
|
|
|
|
log_warn() {
|
|
echo -e "${YELLOW}!${NC}"
|
|
}
|
|
|
|
log_skip() {
|
|
echo -e "${GRAY}-${NC}"
|
|
}
|
|
|
|
# For errors, show full output prominently (not grayed)
|
|
log_error_output() {
|
|
echo "$1"
|
|
}
|
|
|
|
# Final summary
|
|
log_summary() {
|
|
echo ""
|
|
echo -e "${BOLD}$1${NC}"
|
|
}
|
|
|
|
# Detailed output (errors, etc.)
|
|
log_detail() {
|
|
echo -e "${GRAY}$1${NC}"
|
|
} |