[Lldb-commits] [PATCH] D121131: [lldb] Support "bright" ANSI colors
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 7 12:10:07 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0acc9e4b5edd: [lldb] Support "bright" ANSI colors (authored by JDevlieghere).
Changed prior to commit:
https://reviews.llvm.org/D121131?vs=413511&id=413585#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121131/new/
https://reviews.llvm.org/D121131
Files:
lldb/include/lldb/Utility/AnsiTerminal.h
Index: lldb/include/lldb/Utility/AnsiTerminal.h
===================================================================
--- lldb/include/lldb/Utility/AnsiTerminal.h
+++ lldb/include/lldb/Utility/AnsiTerminal.h
@@ -1,7 +1,3 @@
-#ifndef LLDB_UTILITY_ANSITERMINAL_H
-
-#define LLDB_UTILITY_ANSITERMINAL_H
-
//===---------------------AnsiTerminal.h ------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -10,6 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#ifndef LLDB_UTILITY_ANSITERMINAL_H
+#define LLDB_UTILITY_ANSITERMINAL_H
+
#define ANSI_FG_COLOR_BLACK 30
#define ANSI_FG_COLOR_RED 31
#define ANSI_FG_COLOR_GREEN 32
@@ -19,6 +18,15 @@
#define ANSI_FG_COLOR_CYAN 36
#define ANSI_FG_COLOR_WHITE 37
+#define ANSI_FG_COLOR_BRIGHT_BLACK 90
+#define ANSI_FG_COLOR_BRIGHT_RED 91
+#define ANSI_FG_COLOR_BRIGHT_GREEN 92
+#define ANSI_FG_COLOR_BRIGHT_YELLOW 93
+#define ANSI_FG_COLOR_BRIGHT_BLUE 94
+#define ANSI_FG_COLOR_BRIGHT_PURPLE 95
+#define ANSI_FG_COLOR_BRIGHT_CYAN 96
+#define ANSI_FG_COLOR_BRIGHT_WHITE 97
+
#define ANSI_BG_COLOR_BLACK 40
#define ANSI_BG_COLOR_RED 41
#define ANSI_BG_COLOR_GREEN 42
@@ -28,6 +36,15 @@
#define ANSI_BG_COLOR_CYAN 46
#define ANSI_BG_COLOR_WHITE 47
+#define ANSI_BG_COLOR_BRIGHT_BLACK 100
+#define ANSI_BG_COLOR_BRIGHT_RED 101
+#define ANSI_BG_COLOR_BRIGHT_GREEN 102
+#define ANSI_BG_COLOR_BRIGHT_YELLOW 103
+#define ANSI_BG_COLOR_BRIGHT_BLUE 104
+#define ANSI_BG_COLOR_BRIGHT_PURPLE 105
+#define ANSI_BG_COLOR_BRIGHT_CYAN 106
+#define ANSI_BG_COLOR_BRIGHT_WHITE 107
+
#define ANSI_SPECIAL_FRAMED 51
#define ANSI_SPECIAL_ENCIRCLED 52
@@ -67,6 +84,7 @@
bool do_color = true) {
// Convert "${ansi.XXX}" tokens to ansi values or clear them if do_color is
// false.
+ // clang-format off
static const struct {
const char *name;
const char *value;
@@ -81,6 +99,14 @@
{"fg.purple}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_PURPLE) ANSI_ESC_END},
{"fg.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_CYAN) ANSI_ESC_END},
{"fg.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_WHITE) ANSI_ESC_END},
+ {"fg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLACK) ANSI_ESC_END},
+ {"fg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_RED) ANSI_ESC_END},
+ {"fg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_GREEN) ANSI_ESC_END},
+ {"fg.bright.yellow}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_YELLOW) ANSI_ESC_END},
+ {"fg.bright.blue}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_BLUE) ANSI_ESC_END},
+ {"fg.bright.purple}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_PURPLE) ANSI_ESC_END},
+ {"fg.bright.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_CYAN) ANSI_ESC_END},
+ {"fg.bright.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BRIGHT_WHITE) ANSI_ESC_END},
{"bg.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BLACK) ANSI_ESC_END},
{"bg.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_RED) ANSI_ESC_END},
{"bg.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_GREEN) ANSI_ESC_END},
@@ -89,6 +115,14 @@
{"bg.purple}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_PURPLE) ANSI_ESC_END},
{"bg.cyan}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_CYAN) ANSI_ESC_END},
{"bg.white}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_WHITE) ANSI_ESC_END},
+ {"bg.bright.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_BLACK) ANSI_ESC_END},
+ {"bg.bright.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_RED) ANSI_ESC_END},
+ {"bg.bright.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_GREEN) ANSI_ESC_END},
+ {"bg.bright.yellow}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_YELLOW) ANSI_ESC_END},
+ {"bg.bright.blue}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_BLUE) ANSI_ESC_END},
+ {"bg.bright.purple}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_PURPLE) ANSI_ESC_END},
+ {"bg.bright.cyan}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_CYAN) ANSI_ESC_END},
+ {"bg.bright.white}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BRIGHT_WHITE) ANSI_ESC_END},
{"normal}", ANSI_ESC_START _TO_STR(ANSI_CTRL_NORMAL) ANSI_ESC_END},
{"bold}", ANSI_ESC_START _TO_STR(ANSI_CTRL_BOLD) ANSI_ESC_END},
{"faint}", ANSI_ESC_START _TO_STR(ANSI_CTRL_FAINT) ANSI_ESC_END},
@@ -106,6 +140,7 @@
#undef _TO_STR
#undef _TO_STR2
};
+ // clang-format on
auto codes = llvm::makeArrayRef(g_color_tokens);
static const char tok_hdr[] = "${ansi.";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121131.413585.patch
Type: text/x-patch
Size: 4628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220307/77c14adc/attachment.bin>
More information about the lldb-commits
mailing list