diff --git a/src/terminal/display.c b/src/terminal/display.c index cd9f6a6d..a1f37b3e 100644 --- a/src/terminal/display.c +++ b/src/terminal/display.c @@ -128,6 +128,13 @@ int __guac_terminal_set_colors(guac_terminal_display* display, display->glyph_foreground = *foreground; display->glyph_background = *background; + /* Modify color if half-bright (low intensity) */ + if (attributes->half_bright) { + display->glyph_foreground.red /= 2; + display->glyph_foreground.green /= 2; + display->glyph_foreground.blue /= 2; + } + return 0; } diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 711a0fa8..bba95f06 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -296,11 +296,12 @@ guac_terminal* guac_terminal_create(guac_client* client, guac_terminal_char default_char = { .value = 0, .attributes = { - .foreground = guac_terminal_palette[default_foreground], - .background = guac_terminal_palette[default_background], - .bold = false, - .reverse = false, - .underscore = false + .foreground = guac_terminal_palette[default_foreground], + .background = guac_terminal_palette[default_background], + .bold = false, + .half_bright = false, + .reverse = false, + .underscore = false }, .width = 1 }; diff --git a/src/terminal/terminal/types.h b/src/terminal/terminal/types.h index 7d3cd537..0d054f8f 100644 --- a/src/terminal/terminal/types.h +++ b/src/terminal/terminal/types.h @@ -46,6 +46,12 @@ typedef struct guac_terminal_attributes { */ bool bold; + /** + * Whether the character should be rendered with half brightness (faint + * or low intensity). + */ + bool half_bright; + /** * Whether the character should be rendered with reversed colors * (background becomes foreground and vice-versa). diff --git a/src/terminal/terminal_handlers.c b/src/terminal/terminal_handlers.c index 55fd6824..e0be18f6 100644 --- a/src/terminal/terminal_handlers.c +++ b/src/terminal/terminal_handlers.c @@ -897,6 +897,10 @@ int guac_terminal_csi(guac_terminal* term, unsigned char c) { else if (value == 1) term->current_attributes.bold = true; + /* Faint (low intensity) */ + else if (value == 2) + term->current_attributes.half_bright = true; + /* Underscore on */ else if (value == 4) term->current_attributes.underscore = true; @@ -906,8 +910,10 @@ int guac_terminal_csi(guac_terminal* term, unsigned char c) { term->current_attributes.reverse = true; /* Normal intensity (not bold) */ - else if (value == 21 || value == 22) + else if (value == 21 || value == 22) { term->current_attributes.bold = false; + term->current_attributes.half_bright = false; + } /* Reset underscore */ else if (value == 24)