From: Iain Patterson <me@iain.cx>
Date: Tue, 24 Jun 2014 12:52:56 +0000 (+0100)
Subject: Colours for PS2 and PS4.
X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=a8e823fa2005ab190af0461c967f353b7dbb5a51;p=profile.git

Colours for PS2 and PS4.
---

diff --git a/.profile.d/ps2.bashrc b/.profile.d/ps2.bashrc
new file mode 100644
index 0000000..73ee0ad
--- /dev/null
+++ b/.profile.d/ps2.bashrc
@@ -0,0 +1,32 @@
+#!bash Coloured prompts.
+# profile-required: ps1.bashrc
+
+case $(tput colors) in
+  256)
+    PS2_COLOUR1="0;38;5;22"
+    PS2_COLOUR2="0;38;5;28"
+    PS2_COLOUR3="0;38;5;34"
+    PS2_COLOUR4="0;38;5;40"
+  ;;
+
+  88)
+    PS2_COLOUR1="0;38;5;20"
+    PS2_COLOUR2="0;38;5;24"
+    PS2_COLOUR3="0;38;5;24"
+    PS2_COLOUR4="0;38;5;28"
+  ;;
+
+  *)
+    PS2_COLOUR1="0;32"
+    PS2_COLOUR2="0;32"
+    PS2_COLOUR3="1;32"
+    PS2_COLOUR4="1;32"
+  ;;
+esac
+
+function __ps2() {
+  PS2='\[\033[0m\]\[\033[$(__ps1_colour_escape 0 $PS2_COLOUR1)m\]>\[\033[$(__ps1_colour_escape 0 $PS2_COLOUR2)m\]>\[\033[$(__ps1_colour_escape 0 $PS2_COLOUR3)m\]>\[\033[$(__ps1_colour_escape 0 $PS2_COLOUR4)m\]> \[\033[0m\]'
+  return 0
+}
+
+__ps2
diff --git a/.profile.d/ps4.bashrc b/.profile.d/ps4.bashrc
new file mode 100644
index 0000000..3746ac9
--- /dev/null
+++ b/.profile.d/ps4.bashrc
@@ -0,0 +1,26 @@
+#!bash Coloured prompts.
+# profile-required: ps1.bashrc
+
+case $(tput colors) in
+  256)
+    PS4_COLOUR1="0;38;5;20"
+    PS4_COLOUR2="0;38;5;26"
+  ;;
+
+  88)
+    PS4_COLOUR1="0;38;5;19"
+    PS4_COLOUR2="0;38;5;23"
+  ;;
+
+  *)
+    PS4_COLOUR1="0;36"
+    PS4_COLOUR2="1;36"
+  ;;
+esac
+
+function __ps4() {
+  PS4='\[\033[0m\]\[\033[$(__ps1_colour_escape 0 $PS4_COLOUR1)m\][\[\033[$(__ps1_colour_escape 0 $PS4_COLOUR2)m\]${0##*/}:$LINENO\[\033[$(__ps1_colour_escape 0 $PS4_COLOUR1)m\]] \[\033[0m\]'
+  return 0
+}
+
+__ps4