From 5c8ed315f7ba0f37cab683e50b0f75e69a8b8323 Mon Sep 17 00:00:00 2001 From: iridiumR Date: Tue, 20 Sep 2022 20:26:26 +0800 Subject: [PATCH] feat: add some color --- config.h | 8 ++++++++ loop.c | 2 +- loop.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.h b/config.h index 15b646f..e9b70f1 100644 --- a/config.h +++ b/config.h @@ -9,4 +9,12 @@ #define LINE_BUF_SIZE 1024 +#define ANSI_COLOR_RED "\x1b[31m" +#define ANSI_COLOR_GREEN "\x1b[32m" +#define ANSI_COLOR_YELLOW "\x1b[33m" +#define ANSI_COLOR_BLUE "\x1b[34m" +#define ANSI_COLOR_MAGENTA "\x1b[35m" +#define ANSI_COLOR_CYAN "\x1b[36m" +#define ANSI_COLOR_RESET "\x1b[0m" + #endif \ No newline at end of file diff --git a/loop.c b/loop.c index dfc004a..f9edecc 100644 --- a/loop.c +++ b/loop.c @@ -17,7 +17,7 @@ int loop() { char *line; char **args; - printf("> "); + printf(ANSI_COLOR_GREEN"> "ANSI_COLOR_RESET); line = readLine(); args = splitLine(line); status = commandExec(args); diff --git a/loop.h b/loop.h index ddf39bd..d5f4c48 100644 --- a/loop.h +++ b/loop.h @@ -6,5 +6,6 @@ */ #ifndef _LOOP_H_ #define _LOOP_H_ +#include "config.h" int loop(); #endif \ No newline at end of file