You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The answer is complicated and it depends on how the colors are set in the first place 😁
If the underlying program is running on Windows and is using the WinAPI to set console colors via SetConsoleTextAttribute (or the equivalent framework APIs, such as the Console.SetForegroundColor(...) in .NET, for example), then no, it's not possible to retrieve them. The colors are communicated to the console window itself, not as part of the program's output.
If the underlying program is using ANSI escape sequences to set console colors, then it is possible theoretically, as the codes are part of the standard output/error. However, most programs will most likely choose to not output those codes when they detect that the output streams are redirected (which normally implies that the output needs to be clean). In some cases it's possible to override this behavior, but it depends on how the program itself is implemented. Additionally, even if you do manage to extract those codes, you will still need to be able to parse them and re-render them, which is a separate problem in itself (although solvable). Also, #225 may help in running command-line programs with a pseudo terminal, making the former think they have a real console window to interact with.
Version
3.6.6
Platform
.NET 8 / Windows 11
Steps to reproduce
1️⃣ Create an .NET executable which uses Serilog to write colored output.
2️⃣ Run this executable using:
Details
Expected colors like this:
![image](https://private-user-images.githubusercontent.com/249938/366931829-48396400-f703-4759-9c39-d861f916a8c6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTAxMzgsIm5iZiI6MTczOTI0OTgzOCwicGF0aCI6Ii8yNDk5MzgvMzY2OTMxODI5LTQ4Mzk2NDAwLWY3MDMtNDc1OS05YzM5LWQ4NjFmOTE2YThjNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQwNDU3MThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04NDMyNzZkZWFjNDVmNzI3NjQ1YjY2YjgxYWIxOTRiNTI0ODQ0N2E4YzU3Njk1NmI2M2ZjNjYyMjliNGI5YmE5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.IWFzuG7iKilQB7HpCsGPjog9ls2sq0pzJ8IhNU_uO38)
Actual it's just text without any color.
Checklist
The text was updated successfully, but these errors were encountered: