-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
Hello, my 1st issue.
I have setup my console terminal (TCC from JPsoft) to use blue background on Win-10.
Running both examples programs, the colours look awful:

With a little patch to acutest_colored_printf_(), it could look a bit nicer:

Here is my patch:
--- a/include/acutest.h 2024-10-31 11:23:21
+++ b/include/acutest.h 2024-10-31 11:29:49
@@ -628,8 +628,10 @@
case ACUTEST_COLOR_YELLOW_INTENSIVE_: attr = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY; break;
default: attr = 0; break;
}
- if(attr != 0)
+ if(attr != 0) {
+ attr |= (info.wAttributes & ~7); /* mask in the default background colour */
SetConsoleTextAttribute(h, attr);
+ }
n = printf("%s", buffer);
SetConsoleTextAttribute(h, info.wAttributes);
return n;Another option would be to detect if ANSI-sequences are supported:
DWORD mode = 0;
GetConsoleMode (h, &mode);
bool okay = (mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING);if okay set colours as for ACUTEST_UNIX_.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels