• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

A.2 library(ansi_term): Print decorated text to ANSI consoles
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(ansi_term): Print decorated text to ANSI consoles
          • ansi_format/3
          • ansi_format/4
          • ansi_sgr/2
          • console_color/3
          • console_color/2
          • theme_base/2
          • message_line_element/2
          • ansi_hyperlink/2
          • ansi_hyperlink/3
          • tty_url_hook/2
          • ansi_get_color/2
    • Packages
Availability::- use_module(library(ansi_term)).(can be autoloaded)
Source[det]ansi_hyperlink(+Stream, +Location)
[det]ansi_hyperlink(+Stream, +Location, +Label)
Create a hyperlink for a terminal emulator using the OSC 8 escape sequence. Location is one of

  • An absolute URL
  • An atom (interpreted as a file name)
  • A term File:Line
  • A term File:Line:Column

There is no official standard for encoding the Line and Column. We emit

``file://AbsFileName[#Line[:Column]]``

Both Line and Column count from 1, as in the messages we print and as used by e.g., rg --hyperlink-format=.... Note that a capital L before the line, as used by GitHub, is accepted by Epilog as well.

The sequence is emitted if and only if the Prolog flag hyperlink_term is true and Stream has the property tty(true). ansi_format/4 is guarded the same way for color_term, so that a message captured using with_output_to/2 is plain text.

See also
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
ClioPatria (version V3.1.1-59-g7b9a7a3)