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

Text Color not working on Linux #26

Closed
DkAngelito opened this issue Jun 21, 2020 · 1 comment
Closed

Text Color not working on Linux #26

DkAngelito opened this issue Jun 21, 2020 · 1 comment
Assignees

Comments

@DkAngelito
Copy link

Hi,
Is it possible to display colors for text on Linux (RHEL)?

I formatted some documents with colored text on Windows and everything works fine

CipheConsoleWIn
This is how it looks on Windows

but when I run it on Linux (Redhat Enterprise Linux) no colors are displayed as you can see in the following picture.
CipheConsoleRHEL

To note, the system is able to show colors, as seen in the above picture, with the ls command files and directories are listed using colors.

So why it does not show correctly the colors? Do I have to do something special?

@Athari
Copy link
Owner

Athari commented Jun 24, 2020

@DkAngelito
The library is using standard .NET API for terminal (Console.ForegroundColor and Console.BackgroundColor), so if you're using the default console rendering, then it works if and only if the standard .NET API works.

System API for console colors differs massively on Windows and *nix. In case of Windows, it's ancient API which works the same way on every Windows (plus I assume new API for newest Windows 10 console; haven't checked it out yet). In case of Linux, it's non-standartized ANSI codes which differ from one *nix to another, from one terminal to another. .NET performs some dark magic to detect what's supposed to work and I assume when it fails, it doesn't provide color support.

If that is the case, you can still get colored output using this library, but you'll have to manually provide ANSI codes for AnsiRenderTarget and pass it to the rendering function.

@Athari Athari self-assigned this Jun 24, 2020
@Athari Athari added the type:support Support label Jun 24, 2020
@Athari Athari added the resolved:done Done label Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants