Advertisement
Jackspade9624

color code examples bash

Apr 20th, 2025
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Define color codes
  4. RED='\033[0;31m'
  5. GREEN='\033[0;32m'
  6. YELLOW='\033[0;33m'
  7. BLUE='\033[0;34m'
  8. MAGENTA='\033[0;35m'
  9. CYAN='\033[0;36m'
  10. WHITE='\033[0;37m'
  11. NC='\033[0m' # No Color (reset)
  12.  
  13. # Example usage
  14. echo -e "This is ${RED}red${NC} text."
  15. echo -e "This is ${GREEN}green${NC} text."
  16. echo -e "This is ${YELLOW}yellow${NC} text."
  17. echo -e "This is ${BLUE}blue${NC} text."
  18. echo -e "This is ${MAGENTA}magenta${NC} text."
  19. echo -e "This is ${CYAN}cyan${NC} text."
  20. echo -e "This is ${WHITE}white${NC} text."
  21.  
  22. # You can also use it directly without variables:
  23. echo -e "This is \033[1;36m bold cyan \033[0m text"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement