Colours for PS2 and PS4.
[profile.git] / .profile.d / ps4.bashrc
diff --git a/.profile.d/ps4.bashrc b/.profile.d/ps4.bashrc
new file mode 100644 (file)
index 0000000..3746ac9
--- /dev/null
@@ -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