forked from hoelzro/ansicolors
-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Windows has gained suppprt for ANSI sequences (since 2019, a specific release of 2010 added it).
- ANSI sequences are available
- might not be enabled by default
- Windows API function
setconsolemode()can be used to enable it - It can also be enabled by using
os.executeas a workaround
So imho the behaviour of this library should be adjusted. But it is slightly problematic I think;
- enabling colors on Windows by default is breaking behaviour
- on Posix it is assumed that the caller of the library wants to use colors (since there are no checks whatsoever, eg using an
isaptyfunction to detect a pty) - so enabling color by default on Windows would make sense... though support for it might not be enabled...
So I see 2 options:
- follow Posix behaviour and enable colors by default, if the caller doesn't want colors, then just don't use the lib.
- Caller is responsible for proper checks and balances, as well as setup.
- Lines up best with the Posix behaviour
- breaking
- enable colors, but make the calls to enable color support (using an external lib to call
setconsolemodeor use theos.executeworkaround.- Doing the setup for the caller.
- less breaking
- Responsibilities are different from Posix (since caller doesn't do the setup)
wdyt?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels