GUACAMOLE-278: Provide constants defining locations of dark vs. intense colors in 16-color palette.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/a0402288 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/a0402288 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/a0402288 Branch: refs/heads/master Commit: a04022883caaa616e4ae5334a5beccf079043a4b Parents: 1018009 Author: Michael Jumper <[email protected]> Authored: Sun Apr 23 17:32:33 2017 -0700 Committer: Michael Jumper <[email protected]> Committed: Wed Apr 26 21:01:53 2017 -0700 ---------------------------------------------------------------------- src/terminal/display.c | 8 +++++--- src/terminal/terminal/palette.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/a0402288/src/terminal/display.c ---------------------------------------------------------------------- diff --git a/src/terminal/display.c b/src/terminal/display.c index 8d2b131..cd9f6a6 100644 --- a/src/terminal/display.c +++ b/src/terminal/display.c @@ -118,9 +118,11 @@ int __guac_terminal_set_colors(guac_terminal_display* display, } /* Handle bold */ - if (attributes->bold && foreground->palette_index >= 0 - && foreground->palette_index <= 7) { - foreground = &guac_terminal_palette[foreground->palette_index + 8]; + if (attributes->bold + && foreground->palette_index >= GUAC_TERMINAL_FIRST_DARK + && foreground->palette_index <= GUAC_TERMINAL_LAST_DARK) { + foreground = &guac_terminal_palette[foreground->palette_index + + GUAC_TERMINAL_INTENSE_OFFSET]; } display->glyph_foreground = *foreground; http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/a0402288/src/terminal/terminal/palette.h ---------------------------------------------------------------------- diff --git a/src/terminal/terminal/palette.h b/src/terminal/terminal/palette.h index 1016368..b18038f 100644 --- a/src/terminal/terminal/palette.h +++ b/src/terminal/terminal/palette.h @@ -106,6 +106,36 @@ #define GUAC_TERMINAL_COLOR_WHITE 15 /** + * The index of the first low-intensity color in the 16-color portion of the + * palette. + */ +#define GUAC_TERMINAL_FIRST_DARK 0 + +/** + * The index of the last low-intensity color in the 16-color portion of the + * palette. + */ +#define GUAC_TERMINAL_LAST_DARK 7 + +/** + * The index of the first high-intensity color in the 16-color portion of the + * palette. + */ +#define GUAC_TERMINAL_FIRST_INTENSE 8 + +/** + * The index of the last high-intensity color in the 16-color portion of the + * palette. + */ +#define GUAC_TERMINAL_LAST_INTENSE 15 + +/** + * The distance between the palette indices of the dark colors (0 through 7) + * and the bright colors (8 - 15) in the 16-color portion of the palette. + */ +#define GUAC_TERMINAL_INTENSE_OFFSET 8 + +/** * An RGB color, where each component ranges from 0 to 255. */ typedef struct guac_terminal_color {
