You can now custom color all the colors in the distro and os ascii art! See 1.1.md

This commit is contained in:
Dylan 2016-02-04 12:50:50 +11:00
parent 4cd940052c
commit d7d8600f1b
3 changed files with 54 additions and 45 deletions

7
1.1.md
View File

@ -22,6 +22,8 @@
- Added support for displaying ascii art inside of text files. - Added support for displaying ascii art inside of text files.
- Added "screenfetch mode" which will display your distro's ascii art next to the info. \[1\]<br \> - Added "screenfetch mode" which will display your distro's ascii art next to the info. \[1\]<br \>
- Added `--ascii_distro` to choose which distro's ascii logo to display. - Added `--ascii_distro` to choose which distro's ascii logo to display.
- Added `--ascii_colors` and `$ascii_colors` which allow you to change the colors of the ascii art<br \>
and distro logos. \[2\]
- Rename `--shuffledir` and `$shuffledir` to `shuffle_dir`. - Rename `--shuffledir` and `$shuffledir` to `shuffle_dir`.
- Rename `--imgtempdir` and `$imgtempdir` to `thumbnail_dir` - Rename `--imgtempdir` and `$imgtempdir` to `thumbnail_dir`
- Default thumbnail directory is now `$HOME/.cache/thumbnails/fetch`. Thanks @tudurom - Default thumbnail directory is now `$HOME/.cache/thumbnails/fetch`. Thanks @tudurom
@ -34,7 +36,10 @@ fetch --ascii "path/to/ascii" --ascii_color 2
``` ```
\[1\] **[How do I enable screenfetch mode?](http://github.com/dylanaraps/fetch#how-do-i-enable-screenfetch-mode)** \[1\] **[How do I enable screenfetch mode?](http://github.com/dylanaraps/fetch#how-do-i-enable-screenfetch-mode)**<br \>
\[2\] `ascii_colors` takes a range of colors which allows you to color every aspect of<br \>
distro and OS ascii art. For custom art the script will color the entirety of it using<br \>
the first value of `ascii_colors`.
### Config file ### Config file

View File

@ -281,11 +281,14 @@ xoffset=0
# --ascii 'distro', path/to/ascii # --ascii 'distro', path/to/ascii
ascii="distro" ascii="distro"
# Ascii color # Ascii colors
# When this is set to distro it will use your # When this is set to distro it will use your
# ditro's colors to color the ascii. # ditro's colors to color the ascii.
# --ascii_color distro, number # NOTE: You can also set this to a range of colors
ascii_color="distro" # which will allow you to custom color distro logos
# --ascii_colors distro
# --ascii_colors 2 4 5 6
ascii_colors=(distro)
# }}} # }}}

83
fetch
View File

@ -301,11 +301,14 @@ xoffset=0
# --ascii 'distro', path/to/ascii # --ascii 'distro', path/to/ascii
ascii="distro" ascii="distro"
# Ascii color # Ascii colors
# When this is set to distro it will use your # When this is set to distro it will use your
# ditro's colors to color the ascii. # ditro's colors to color the ascii.
# --ascii_color distro, number # NOTE: You can also set this to a range of colors
ascii_color="distro" # which will allow you to custom color distro logos
# --ascii_colors distro
# --ascii_colors 2 4 5 6
ascii_colors=(distro)
# }}} # }}}
@ -1554,13 +1557,13 @@ getascii () {
# Overwrite distro colors if '$ascii_color` doesn't # Overwrite distro colors if '$ascii_color` doesn't
# equal 'distro'. # equal 'distro'.
if [ "$ascii_color" != "distro" ]; then if [ "$ascii_colors" != "distro" ]; then
c1=$(color $ascii_color) c1=$(color ${ascii_colors[0]})
c2=$(color $ascii_color) c2=$(color ${ascii_colors[1]})
c3=$(color $ascii_color) c3=$(color ${ascii_colors[2]})
c4=$(color $ascii_color) c4=$(color ${ascii_colors[3]})
c5=$(color $ascii_color) c5=$(color ${ascii_colors[4]})
c6=$(color $ascii_color) c6=$(color ${ascii_colors[5]})
fi fi
# We only use eval in the distro ascii files. # We only use eval in the distro ascii files.
@ -1571,7 +1574,7 @@ getascii () {
*) ascii_color="$(color $ascii_color)" ;; *) ascii_color="$(color $ascii_color)" ;;
esac esac
print="${ascii_color}$(<"$ascii")" print="$(color ${ascii_colors[0]})$(<"$ascii")"
fi fi
# Turn the file into a variable. # Turn the file into a variable.
@ -1958,20 +1961,6 @@ esac
# }}} # }}}
# Unset function {{{
unset_func () {
for func in "$@"; do
case "$func" in
"--disable") continue ;;
"--"*) return ;;
*) unset -f "get$func" ;;
esac
done
}
#}}}
# }}} # }}}
@ -2086,7 +2075,6 @@ exit 1
while [ "$1" ]; do while [ "$1" ]; do
case $1 in case $1 in
# Info # Info
--disable) unset_func "$@" ;;
--os_arch) os_arch="$2" ;; --os_arch) os_arch="$2" ;;
--osx_buildversion) osx_buildversion="$2" ;; --osx_buildversion) osx_buildversion="$2" ;;
--speed_type) speed_type="$2" ;; --speed_type) speed_type="$2" ;;
@ -2102,6 +2090,15 @@ while [ "$1" ]; do
--battery_shorthand) battery_shorthand="$2" ;; --battery_shorthand) battery_shorthand="$2" ;;
--birthday_shorthand) birthday_shorthand="$2" ;; --birthday_shorthand) birthday_shorthand="$2" ;;
--birthday_time) birthday_time="$2" ;; --birthday_time) birthday_time="$2" ;;
--disable)
for func in "$@"; do
case "$func" in
"--disable") continue ;;
"--"*) return ;;
*) unset -f "get$func" ;;
esac
done
;;
# Text Colors # Text Colors
--title_color) title_color=$2 ;; --title_color) title_color=$2 ;;
@ -2123,12 +2120,9 @@ while [ "$1" ]; do
--block_width) block_width="$2" ;; --block_width) block_width="$2" ;;
# Image # Image
--image) image="$2" --image)
[ -z "$2" ] && image="ascii" image="$2"
case "$2" in "--"* | "") image="ascii" ;; esac
case "$2" in
"--"*) image="ascii" ;;
esac
;; ;;
--image_backend) image_backend="$2" ;; --image_backend) image_backend="$2" ;;
@ -2144,20 +2138,27 @@ while [ "$1" ]; do
--clean) rm -rf "$thumbnail_dir" || exit ;; --clean) rm -rf "$thumbnail_dir" || exit ;;
# Ascii # Ascii
--ascii) image="ascii"; ascii="$2" --ascii)
[ -z "$2" ] && ascii="distro" image="ascii"
ascii="$2"
case "$2" in case "$2" in "--"* | "") ascii="distro" ;; esac
"--"*) ascii="distro" ;;
esac
;; ;;
--ascii_color) ascii_color="$2" ;; --ascii_colors)
unset ascii_colors
for arg in "$2" "$3" "$4" "$5" "$6" "$7"; do
case "$arg" in
"$1") continue ;;
"--"*) break ;;
*) ascii_colors+=($arg)
esac
done
ascii_colors+=(7 7 7 7 7)
;;
--ascii_distro) ascii_distro="$2" ;; --ascii_distro) ascii_distro="$2" ;;
# Screenshot # Screenshot
--scrot | -s) scrot="on"; \ --scrot | -s) scrot="on"; [ "$2" ] && scrot_path="$2" ;;
[ "$2" ] && scrot_path="$2" ;;
--scrot_cmd) scrot_cmd="$2" ;; --scrot_cmd) scrot_cmd="$2" ;;
# Other # Other