mirror of
https://github.com/lephisto/crossover.git
synced 2025-12-06 04:09:20 +01:00
Add Helper for bash colors
This commit is contained in:
51
rainbow.sh
Normal file
51
rainbow.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
# https://github.com/xr09/rainbow.sh
|
||||
# Bash helper functions to put colors on your scripts
|
||||
#
|
||||
# Usage example:
|
||||
# vargreen=$(echogreen "Grass is green")
|
||||
# echo "Coming next: $vargreen"
|
||||
#
|
||||
|
||||
__RAINBOWPALETTE="1"
|
||||
|
||||
function __colortext()
|
||||
{
|
||||
echo -e " \e[$__RAINBOWPALETTE;$2m$1\e[0m"
|
||||
}
|
||||
|
||||
|
||||
function echogreen()
|
||||
{
|
||||
echo $(__colortext "$1" "32")
|
||||
}
|
||||
|
||||
function echored()
|
||||
{
|
||||
echo $(__colortext "$1" "31")
|
||||
}
|
||||
|
||||
function echoblue()
|
||||
{
|
||||
echo $(__colortext "$1" "34")
|
||||
}
|
||||
|
||||
function echopurple()
|
||||
{
|
||||
echo $(__colortext "$1" "35")
|
||||
}
|
||||
|
||||
function echoyellow()
|
||||
{
|
||||
echo $(__colortext "$1" "33")
|
||||
}
|
||||
|
||||
function echocyan()
|
||||
{
|
||||
echo $(__colortext "$1" "36")
|
||||
}
|
||||
|
||||
function echowhite()
|
||||
{
|
||||
echo $(__colortext "$1" "37")
|
||||
}
|
||||
Reference in New Issue
Block a user