GUACAMOLE-278: Provide constants defining locations of dark vs. intense colors in 16-color palette.

This commit is contained in:
Michael Jumper 2017-04-23 17:32:33 -07:00
parent 10180095d8
commit a04022883c
2 changed files with 35 additions and 3 deletions

View File

@ -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;

View File

@ -105,6 +105,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.
*/