Add color function

This commit is contained in:
Dylan 2016-01-21 09:49:50 +11:00
parent 515e2621a2
commit f7c37dd934

13
fetch
View file

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