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

Provide an adaptive theme #34

Open
nblumhardt opened this issue Feb 7, 2018 · 1 comment
Open

Provide an adaptive theme #34

nblumhardt opened this issue Feb 7, 2018 · 1 comment

Comments

@nblumhardt
Copy link
Member

The ANSI themes provided with this sink look the best, but aren't supported on many Windows versions, and shouldn't be used unless the output is going to a terminal. Some users don't want theming at all.

This creates a bit of a challenge for portable apps that want to look good.

Could we create an AdaptiveConsoleTheme.Default (plus some other portable variants like Grayscale) that dispatches to either SystemConsoleTheme, AnsiConsoleTheme or ConsoleTheme.None depending on the run-time environment?

This would choose ANSI output when supported, Windows console theming when appropriate, or no theming when output is piped or the user has indicated they do not want color output (see below).

Terminal capability detection is a bit of a minefield; http://bixense.com/clicolors/ and http://no-color.org/ propose some environment-variable-based tactics that we might also include support for.

@MV10
Copy link

MV10 commented Aug 26, 2018

@nblumhardt I was debugging into the Console sink this morning chasing that $type thing it outputs, and started thinking about the fact that I've got a cross-platform (Win / Linux / OSX) ncurses wrapper in the works. At the time I was considering a spinoff of this sink dependent on ncurses, then I saw this issue. It might make this problem a lot easier to solve.

The main implementation is done and tested and working on all three platforms, I just need to document it and package it. (I'd also planned more samples etc but those wouldn't block usage.)

Even if you don't like an ncurses dependency, you should check out the cross-platform support. It is 100% transparent to the dependent application, except when you get an oddball Linux platform that uses a different library name, but I have provisions for easily supporting that, too.

https://github.com/MV10/dotnet-curses

Since I don't have docs, you can read about it on my blog here.

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