aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util/color.cc17
-rw-r--r--src/util/prompt.cc12
2 files changed, 23 insertions, 6 deletions
diff --git a/src/util/color.cc b/src/util/color.cc
new file mode 100644
index 0000000..87fd346
--- /dev/null
+++ b/src/util/color.cc
@@ -0,0 +1,17 @@
+#include "util/color.h"
+
+#include <string>
+
+#include "all.h"
+
+using namespace std;
+
+namespace ov4
+{
+
+string make_color(const string s, const string color)
+{
+ return "\e[0;" + color + "m" + s + "\e[0m";
+}
+
+}
diff --git a/src/util/prompt.cc b/src/util/prompt.cc
index ac9137b..6ba1ea9 100644
--- a/src/util/prompt.cc
+++ b/src/util/prompt.cc
@@ -14,15 +14,15 @@ namespace ov4
char buffer[hostname_size];
gethostname(buffer, hostname_size);
cout
- << name
+ << make_color((string)name, ov4::color::bright_green)
<< " "
- << getlogin()
- << "@"
- << buffer
+ << make_color(getlogin(), ov4::color::bright_blue)
+ << make_color("@", ov4::color::bright_blue)
+ << make_color(buffer, ov4::color::bright_blue)
<< ":"
- << get_current_dir()
+ << make_color(get_current_dir(), ov4::color::bright_purple)
<< " "
- << get_prompt()
+ << make_color(get_prompt(), ov4::color::bright_yellow)
<< " "
<< flush;
}