Script color functions

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

Script color functions

#1 Post by jpeps »

I'm sure these must be around somewhere, but in case they're not:
To load functions add ". colors" to script after saving "colors" file in $PATH. It's defaulting to black terminal background.

Code: Select all

#!/bin/sh
 
### example: echo -e $RED"Hello" 

## Black background

 export RED='\E[31;40m'
 export WHITE='\E[37;40m'
 export GREEN='\E[32;40m'
 export YELLOW='\E[33;40m'
 export MAGENTA='\E[35;40m'
 export CYAN='\E[36;40m'
 export BLACK='\E[30;40m'

## White background

# export RED='\E[31;47m'
# export WHITE='\E[37;47m'
# export GREEN='\E[32;47m'
# export YELLOW='\E[33;47m'
# export MAGENTA='\E[35;47m'
# export CYAN='\E[36;47m'
# export BLACK='\E[30;47m'


User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#2 Post by 8-bit »

Thank you! I have your list saved for reference.

Post Reply