[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 09:05:06 PST 2022


JDevlieghere created this revision.
JDevlieghere added reviewers: teemperor, clayborg.
Herald added a project: All.
JDevlieghere requested review of this revision.
Herald added a project: LLDB.

Support ANSI escape codes for bright colors variants. Most modern terminals support them. Still LLDB is not using them by default and there's only there for people who want to modify their preferred ANSI prefix/suffix.


Repository:
  rG LLVM Github Monorepo

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
 
@@ -81,6 +98,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 +114,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},


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121131.413511.patch
Type: text/x-patch
Size: 4176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220307/1771bf1d/attachment.bin>


More information about the lldb-commits mailing list