colorama icon indicating copy to clipboard operation
colorama copied to clipboard

Add support for ANSI hyperlinks

Open ssbarnea opened this issue 7 years ago • 6 comments

See https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda for details as is already implemented by some major terminals.

ssbarnea avatar Jun 21 '17 16:06 ssbarnea

Hi. Thanks for the suggestion. colorama is intended to interpret ANSI codes and convert them so they work in both Linux and Windows. In the list of terminals in the link you provided, I don't see any Windows-based terminals (cmd, PowerShell). If we can't convert the ANSI codes to Windows on Windows machines, there is no point in adding the codes to colorama.. See also the same reasoning in https://github.com/tartley/colorama/issues/38#issuecomment-128834060

wiggin15 avatar Sep 03 '17 10:09 wiggin15

I opened an issue against the windows console to support it

https://github.com/Microsoft/console/issues/204

stuaxo avatar Jun 04 '18 19:06 stuaxo

@ssbarnea Colorama is not focused on this kind of thing.

However, I made a convenience function in my utility module you might like: https://github.com/mixmastamyk/console/blob/master/console/utils.py#L54

mixmastamyk avatar Jan 24 '20 09:01 mixmastamyk

@mixmastamyk I already have a working function https://github.com/pycontribs/gri/blob/master/gri/main.py#L31-L32 that was not the problem.

The problem is that I wanted to make it easy for anyone writing python code to use it, and colorama is the probably the best place to implement that functionality.

One way or another colorama is an ANSI processing library, that is an ansi extension. We could easily document that this works only on some terminal.

We already have a rough time dealing with dependencies, creating another module for a one-lines is a very bad idea from the maintenance point of view.

I personally do not see any issue extending functionality, especially if we add a notice regarding support..

ssbarnea avatar Jan 24 '20 12:01 ssbarnea

@ssbarnea Well, colorama is not an ansi-utility-library per se.

It's really an "enable your existing ansi-utility-library to work on Windows" library. One that has served its purpose now that MS is finally getting it together on that front. Colorama is probably now in maintenance mode.

There are other libraries that might make more sense to add this to.

mixmastamyk avatar Jan 24 '20 21:01 mixmastamyk

Windows 10 supports sequences without any translation layer, https://devblogs.microsoft.com/commandline/24-bit-color-in-the-windows-console/ so I'm not entirely sold on colorama's future as a necessary translator :( I think because of what colorama is, the feature would not be supported in this library.

But I hope to help, the library blessed does windows 10, even inside cmd.exe, the only missing bits was the database of sequences, which @avylove provided with his "jinxed" library, anyway blessed also has this hyperlink feature support you seek, https://blessed.readthedocs.io/en/latest/terminal.html#hyperlinks

best wishes

jquast avatar Feb 03 '20 19:02 jquast