-
Notifications
You must be signed in to change notification settings - Fork 31
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
Render using default foreground and background colors #22
Comments
@fedarovich But yes, it's something I need to do and looks like I can't delay it until implementing the whole set of OS-specific features planned for 2.0. 😆 I'd certainly prefer being able to "inherit" default/current console colors, but with formatting in *nix being built around ANSI codes, there's no way to get them. I guess the only option I have is adding render preferences for things like colors. Line formatter should probably go there too. Hmm, when "reset" ANSI code ( |
On Mac OS (and I guess on other *nix) Console.ResetColor() resets the colors to their default values (set in Terminal options). So I suppose using ResetColor() is the right way to go. One more interesting thing I've discovered is that the default colors are not among the 16 ANSI colors in Mac OS Terminal. The default BG and FG colors and white and black correspondingly (in the default theme) but if you try to use ConsoleColor.White, it is rendered like light gray, not white. The actual settings of default BG and FG colors and ANSI colors mapping are done in the Terminal settings. I guess it may work the same way in some Linux terminals too. So it looks like ResetColor() is the only way to support default BG and FG on *nix. |
I guess 16 "standard" colors can be mapped to any colors. It works even on Windows, where 16 colors can be set for system and per application. RGB values vary a lot between systems and terminals even wihout any customization. Or do you mean you've actually tested all 16 colors and colors which are produced after a reset are not among them? |
@fedarovich |
In the version 1.0 if foreground or background colors are not specified, the white and black colors are used for them. It looks unnatural if other colors are used in the terminal by default, like in Mas OS X Terminal.
It would be nice if it is possible to render the user interface using default colors.
As a workaround, it is possible to set
Color
toConsole.ForegroundColor
andBackground
toConsole.BackgroundColor
but it works only on Windows. On Linux and Mas OS these properties return(ConsoleColor)(-1)
and it looks like there is no easy and universal way to determine the actual colors.The text was updated successfully, but these errors were encountered: