Skip to content

Commit

Permalink
[PR] dylanaraps#1726 from coolreader18 - Allow rgb truecolors to be p…
Browse files Browse the repository at this point in the history
…assed to --ascii_color

Upstream PR: dylanaraps#1726
Thanks to @coolreader18

Co-authored-by: Noah <33094578+coolreader18@users.noreply.github.com>
  • Loading branch information
hykilpikonna and coolreader18 committed Aug 11, 2022
2 parents 3b781bc + d1fac5d commit 93d7b8b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -5113,6 +5113,12 @@ color() {
case $1 in
[0-6]) printf '%b\e[3%sm' "$reset" "$1" ;;
7 | "fg") printf '\e[37m%b' "$reset" ;;
"#"*)
local rgb="${1//#}"
rgb="$((0x$rgb))"
printf '\e[38;2;%b;%b;%bm' "$(($rgb >> 16))" "$((($rgb >> 8) & 0xff))" "$(($rgb & 0xff))"
;;

*) printf '\e[38;5;%bm' "$1" ;;
esac
}
Expand Down

0 comments on commit 93d7b8b

Please sign in to comment.