Added ANSI escape sequences, prompt is bold

This commit is contained in:
Louis 2015-02-12 11:10:00 +01:00
parent a1ed75252f
commit 897c0d5233
3 changed files with 34 additions and 1 deletions

32
src/escape.h Normal file
View file

@ -0,0 +1,32 @@
// ANSI escape sequences
// foreground colors
#define FG_BLACK "\33[30m"
#define FG_RED "\33[31m"
#define FG_GREEN "\33[32m"
#define FG_YELLOW "\33[33m"
#define FG_BLUE "\33[34m"
#define FG_MAJENTA "\33[35m"
#define FG_CYAN "\33[36m"
#define FG_WHITE "\33[37m"
// background colors
#define BG_BLACK "\33[40m"
#define BG_RED "\33[41m"
#define BG_GREEN "\33[42m"
#define BG_YELLOW "\33[43m"
#define BG_BLUE "\33[44m"
#define BG_MAJENTA "\33[45m"
#define BG_CYAN "\33[46m"
#define BG_WHITE "\33[47m"
#define COLOR_OFF "\33[m"
// attributes
#define ATTR_BOLD "\33[1m"
#define ATTR_UNDERSCORE "\33[4m"
#define ATTR_BLINK "\33[5m"
#define ATTR_REVERSE "\33[7m"
#define ATTR_CONCEALED "\33[8m"
#define ATTR_OFF "\33[0m"

View file

@ -52,6 +52,7 @@ static const int g_max_commands = 100;
static int g_verbose = 0;
//
#include "escape.h"
#include "version.h"
typedef enum {

View file

@ -1,3 +1,3 @@
static const char version[] = "1.3-beta";
static const char uname[] = "rpn v1.3-beta, (c) 2015 <louis@rubet.fr>";
static const char prompt[] = "rpn> ";
static const char prompt[] = ATTR_BOLD "rpn" ATTR_OFF "> ";