Skip to content

Conversation

Robert-DeForrest-Reynolds
Copy link

@Robert-DeForrest-Reynolds Robert-DeForrest-Reynolds commented Oct 14, 2025

I added colored logging using ANSI escape codes. I've tested it on Windows 11 (cmd, powershell, and msys), as well as the common Linux distros (Ubuntu, Debian, Arch), and it seems to work perfectly fine. Have not tested on mobile devices.
I changed the example for custom logging to demonstrate how to use the ANSI colors.
The buffer takes in a few less characters, as the "LOG_TYPE: " is simply just printf'd, and I think that's okay. I can't see any negative implications there. Hope all is well, thank you.

Short review:
In src/raylib.h:
Added ANSI colors

In src/utils.c:
strcpy(buffer, "LOG_TYPE: ") -> printf(ANSI_CODE "LOGTYPE: ")

In examples/core_custom_logging.c:
Change the example to demonstrate using ANSI colors for custom logger

PS: this is my first ever pull request, so don't hurt me. I tried to make it small, but "meaningful".

Screenshot 2025-10-14 055004

In src/raylib.h:
Added ANSI colors

In src/utils.c:
strcpy(buffer, "LOG_TYPE: ") -> printf(ANSI_CODE "LOGTYPE: ")

In examples/core_custom_logging.c:
Change the example to demonstrate using ANSI colors for custom logger
@raysan5
Copy link
Owner

raysan5 commented Oct 14, 2025

@Robert-DeForrest-Reynolds Thanks but I'm afraid this change is not portable, not all terminals support it, already been proposed a couple of times in the past. I prefer to avoid it in raylib main library but maybe it can be added to custom logging example?

@raysan5 raysan5 closed this Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants