Add color function

This commit is contained in:
Dylan 2016-01-21 09:49:50 +11:00
parent 515e2621a2
commit f7c37dd934
1 changed files with 9 additions and 4 deletions

13
fetch
View File

@ -42,7 +42,7 @@ export LANGUAGE=C
#
# You can also just use printf / echo to add lines but you'll
# need to prefix your msg with "${padding}", for example:
# echo "${padding} My custom message here"
# echo -e "${padding} My custom message here"
#
# Info functions enabled by default are:
# "title" "distro" "kernel" "uptime" "packages"
@ -51,6 +51,9 @@ export LANGUAGE=C
#
# Info functions that are disabled by default are:
# "resolution" "song" "visualstyle" "gpu"
#
# See this wiki page for more info:
# https://github.com/dylanaraps/fetch/wiki/Customizing-Info
printinfo () {
info title
info underline
@ -1093,7 +1096,6 @@ getimage () {
-scale "$imgsize"x"$imgsize" \
"$imgtempdir/$imgname"
;;
esac
fi
@ -1105,7 +1107,6 @@ takescrot () {
$scrotcmd "$scrotdir/$scrotname"
}
# }}}
@ -1181,6 +1182,10 @@ colors () {
info_color="\e[38;5;${info_color}m"
}
color () {
printf "\e[38;5;${1}m"
}
bold () {
if [ "$bold" == "on" ]; then
bold="\e[1m"
@ -1393,7 +1398,7 @@ fi
if [ "$image" != "off" ]; then
case "$image_backend" in
"w3m")
printf "%b%s" "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\
printf "%b%s\n" "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\
$w3m_img_path
;;