From b2c277946587414ea65e5b75c0639a3713176994 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 28 Jul 2015 16:20:14 -0700 Subject: [PATCH] GUAC-1195: Define and use color constants for terminal. --- src/protocols/ssh/client.c | 3 +- src/protocols/telnet/client.c | 3 +- src/terminal/display.h | 81 +++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 2 deletions(-) diff --git a/src/protocols/ssh/client.c b/src/protocols/ssh/client.c index cb615831..087ce762 100644 --- a/src/protocols/ssh/client.c +++ b/src/protocols/ssh/client.c @@ -24,6 +24,7 @@ #include "client.h" #include "clipboard.h" +#include "display.h" #include "guac_handlers.h" #include "ssh_client.h" #include "terminal.h" @@ -174,7 +175,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) { client_data->font_name, client_data->font_size, client->info.optimal_resolution, client->info.optimal_width, client->info.optimal_height, - 7, 0); + GUAC_TERMINAL_COLOR_GRAY, GUAC_TERMINAL_COLOR_BLACK); /* Fail if terminal init failed */ if (client_data->term == NULL) { diff --git a/src/protocols/telnet/client.c b/src/protocols/telnet/client.c index 424dd6cf..c0996db2 100644 --- a/src/protocols/telnet/client.c +++ b/src/protocols/telnet/client.c @@ -23,6 +23,7 @@ #include "config.h" #include "client.h" #include "clipboard.h" +#include "display.h" #include "guac_handlers.h" #include "telnet_client.h" #include "terminal.h" @@ -201,7 +202,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) { client_data->font_name, client_data->font_size, client->info.optimal_resolution, client->info.optimal_width, client->info.optimal_height, - 7, 0); + GUAC_TERMINAL_COLOR_GRAY, GUAC_TERMINAL_COLOR_BLACK); /* Fail if terminal init failed */ if (client_data->term == NULL) { diff --git a/src/terminal/display.h b/src/terminal/display.h index c9eb1c38..d42d99bd 100644 --- a/src/terminal/display.h +++ b/src/terminal/display.h @@ -40,6 +40,87 @@ */ #define GUAC_TERMINAL_MAX_CHAR_WIDTH 2 +/** + * The index of black within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_BLACK 0 + +/** + * The index of low-intensity red within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_DARK_RED 1 + +/** + * The index of low-intensity green within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_DARK_GREEN 2 + +/** + * The index of brown within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_BROWN 3 + +/** + * The index of low-intensity blue within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_DARK_BLUE 4 + +/** + * The index of low-intensity magenta (purple) within the terminal color + * palette. + */ +#define GUAC_TERMINAL_COLOR_PURPLE 5 + +/** + * The index of low-intensity cyan (teal) within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_TEAL 6 + +/** + * The index of low-intensity white (gray) within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_GRAY 7 + +/** + * The index of bright black (dark gray) within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_DARK_GRAY 8 + +/** + * The index of bright red within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_RED 9 + +/** + * The index of bright green within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_GREEN 10 + +/** + * The index of bright brown (yellow) within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_YELLOW 11 + +/** + * The index of bright blue within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_BLUE 12 + +/** + * The index of bright magenta within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_MAGENTA 13 + +/** + * The index of bright cyan within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_CYAN 14 + +/** + * The index of bright white within the terminal color palette. + */ +#define GUAC_TERMINAL_COLOR_WHITE 15 + /** * The available color palette. All integer colors within structures * here are indices into this palette.