Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace: Change tr_debug color from gray to bright blue #14576

Merged
merged 1 commit into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions platform/mbed-trace/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"value": "malloc",
"macro_name": "MEM_ALLOC"
},
"color-theme": {
"help": "Set color theme. 0 for readable, 1 for unobtrusive.",
"options": [0, 1],
"macro_name": "MBED_TRACE_COLOR_THEME",
"value": 0
},
"deallocator": {
"value": "free",
"macro_name": "MEM_FREE"
Expand Down
7 changes: 7 additions & 0 deletions platform/mbed-trace/source/mbed_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,17 @@
#endif
#endif /* YOTTA_CFG_MEMLIB */

#if defined(MBED_TRACE_COLOR_THEME) && (MBED_TRACE_COLOR_THEME == 1)
#define VT100_COLOR_ERROR "\x1b[31m"
#define VT100_COLOR_WARN "\x1b[33m"
#define VT100_COLOR_INFO "\x1b[39m"
#define VT100_COLOR_DEBUG "\x1b[90m"
#else
#define VT100_COLOR_ERROR "\x1b[31m"
#define VT100_COLOR_WARN "\x1b[33m"
#define VT100_COLOR_INFO "\x1b[39m"
#define VT100_COLOR_DEBUG "\x1b[94m"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may end up into bikeshedding, but did you test with

#define VT100_COLOR_INFO  "\x1b[97m"
#define VT100_COLOR_DEBUG "\x1b[37m"

On my eye+terminal combo the end result was readable and it kept text in same color, just different brightness.

No matter what you choose here, someone will not like it. What if one just made these configurable and let one to choose correct colors at build time from their app config?

Copy link
Contributor

@kjbracey kjbracey Apr 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense in a trace-only world, but that part of the concept is that trace can be interleaved with standard non-trace application output (and maybe even command-line input). So that would mean "info trace" would be brighter than non-trace application output.

I guess you could set "bright white" after each trace line, rather than "default"?

#endif

/** default max trace line size in bytes */
#ifdef MBED_TRACE_LINE_LENGTH
Expand Down