aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-cmds.c
diff options
context:
space:
mode:
authorAndrei Pikas <gdb@mail.api.win>2024-10-05 22:27:44 +0300
committerTom Tromey <tom@tromey.com>2025-01-12 13:30:43 -0700
commit6447969d0ac774b6dec0f95a0d3d27c27d158690 (patch)
treee9812cfdd956f4c8e89f596b276ddc1c4ad8da45 /gdb/cli/cli-cmds.c
parent338e0b05d8f2dd404eb0015bee31461dfe5ba307 (diff)
downloadbinutils-6447969d0ac774b6dec0f95a0d3d27c27d158690.zip
binutils-6447969d0ac774b6dec0f95a0d3d27c27d158690.tar.gz
binutils-6447969d0ac774b6dec0f95a0d3d27c27d158690.tar.bz2
Add an option with a color type.
Colors can be specified as "none" for terminal's default color, as a name of one of the eight standard colors of ISO/IEC 6429 "black", "red", "green", etc., as an RGB hexadecimal tripplet #RRGGBB for 24-bit TrueColor, or as an integer from 0 to 255. Integers 0 to 7 are the synonyms for the standard colors. Integers 8-15 are used for the so-called bright colors from the aixterm extended 16-color palette. Integers 16-255 are the indexes into xterm extended 256-color palette (usually 6x6x6 cube plus gray ramp). In general, 256-color palette is terminal dependent and sometimes can be changed with OSC 4 sequences, e.g. "\033]4;1;rgb:00/FF/00\033\\". It is the responsibility of the user to verify that the terminal supports the specified colors. PATCH v5 changes: documentation fixed. PATCH v6 changes: documentation fixed. PATCH v7 changes: rebase onto master and fixes after review. PATCH v8 changes: fixes after review.
Diffstat (limited to 'gdb/cli/cli-cmds.c')
-rw-r--r--gdb/cli/cli-cmds.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 0140c71..69a7e8b 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2398,6 +2398,11 @@ value_from_setting (const setting &var, struct gdbarch *gdbarch)
return current_language->value_string (gdbarch, value, len);
}
+ case var_color:
+ {
+ std::string s = var.get<ui_file_style::color> ().to_string ();
+ return current_language->value_string (gdbarch, s.c_str (), s.size ());
+ }
default:
gdb_assert_not_reached ("bad var_type");
}
@@ -2445,6 +2450,7 @@ str_value_from_setting (const setting &var, struct gdbarch *gdbarch)
case var_pinteger:
case var_boolean:
case var_auto_boolean:
+ case var_color:
{
std::string cmd_val = get_setshow_command_value_string (var);