aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rwxr-xr-xpfetch15
2 files changed, 16 insertions, 1 deletions
diff --git a/README.md b/README.md
index 9a6a852..7920921 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ _/\ __)/_) pkgs 130
# Default: first example below
# Valid: space separated string
#
-# OFF by default: shell
+# OFF by default: shell palette
PF_INFO="ascii title distro host kernel uptime pkgs memory"
# Example: Only ASCII.
diff --git a/pfetch b/pfetch
index 87beba2..bd3dabb 100755
--- a/pfetch
+++ b/pfetch
@@ -576,6 +576,21 @@ get_memory() {
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6
}
+get_palette() {
+ # Print the first 8 terminal colors. This uses the existing
+ # sequences to change text color with a sequence prepended
+ # to reverse the foreground and background colors.
+ #
+ # This allows us to save hardcoding a second set of sequences
+ # for background colors.
+ palette=" $c1 $c2 $c3 $c4 $c5 $c6 $c7 "
+
+ # Print the palette with a newline before and after.
+ # The '\033[%sC' moves the text to the right, the
+ # length of the ascii art.
+ printf '\n[%sC%s\n' "${ascii_width-1}" "$palette" >&6
+}
+
get_ascii() {
# This is a simple function to read the contents of
# an ascii file from 'stdin'. It allows for the use