/usr/lib/swipl/library/ansi_term.pl
All Application Manual Name SummaryHelp

  • swipl
    • library
      • error.pl
      • debug.pl -- Print debug messages and test assertions
      • apply.pl -- Apply predicates on a list
      • lists.pl
      • broadcast.pl -- Event service
      • shlib.pl -- Utility library for loading foreign objects (DLLs, shared objects)
      • option.pl -- Option list processing
      • thread_pool.pl -- Resource bounded thread management
      • gensym.pl -- Generate unique symbols
      • settings.pl -- Setting management
      • arithmetic.pl
      • main.pl
      • readutil.pl -- Read utilities
      • operators.pl -- Manage operators
      • pairs.pl -- Operations on key-value lists
      • prolog_source.pl -- Examine Prolog source-files
      • record.pl
      • quasi_quotations.pl -- Define Quasi Quotation syntax
      • sandbox.pl
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • yall.pl -- Lambda expressions
      • assoc.pl -- Binary associations
      • prolog_format.pl -- Analyse format specifications
      • pure_input.pl -- Pure Input from files and streams
      • solution_sequences.pl
      • ordsets.pl -- Ordered set manipulation
      • random.pl -- Random numbers
      • base64.pl -- Base64 encoding and decoding
      • aggregate.pl
      • predicate_options.pl -- Access and analyse predicate options
      • csv.pl -- Process CSV (Comma-Separated Values) data
      • pprint.pl -- Pretty Print Prolog terms
      • atom.pl -- Operations on atoms
      • modules.pl
      • occurs.pl -- Finding and counting sub-terms
      • prolog_xref.pl -- Prolog cross-referencer data collection
      • prolog_colour.pl -- Prolog syntax colouring support.
      • lazy_lists.pl
      • ugraphs.pl -- Graph manipulation library
      • url.pl -- Analysing and constructing URL
      • www_browser.pl
      • prolog_pack.pl -- A package manager for Prolog
      • git.pl -- Run GIT commands
      • utf8.pl -- UTF-8 encoding/decoding on lists of character codes.
      • quintus.pl -- Quintus compatibility
      • prolog_versions.pl -- Demand specific (Prolog) versions
      • prolog_wrap.pl -- Wrapping predicates
      • dialect.pl -- Support multiple Prolog dialects
      • date.pl -- Process dates and times
      • persistency.pl -- Provide persistent dynamic predicates
      • iostream.pl -- Utilities to deal with streams
      • prolog_code.pl -- Utilities for reasoning about code
      • strings.pl
      • dif.pl -- The dif/2 constraint
      • edinburgh.pl -- Some traditional Edinburgh predicates
      • terms.pl -- Term manipulation
      • ansi_term.pl -- Print decorated text to ANSI consoles
        • console_color/3
        • console_color/2
        • message_line_element/2
        • ansi_format/3
        • ansi_format/4
        • ansi_sgr/2
        • ansi_hyperlink/2
        • ansi_hyperlink/3
        • tty_url_hook/2
        • ansi_get_color/2
      • threadutil.pl -- Interactive thread utilities
      • prolog_stack.pl -- Examine the Prolog stack
      • prolog_clause.pl
      • prolog_breakpoints.pl -- Manage Prolog break-points
      • wfs.pl -- Well Founded Semantics interface
      • sort.pl
      • dicts.pl -- Dict utilities
      • varnumbers.pl -- Utilities for numbered terms
      • rbtrees.pl -- Red black trees
      • base32.pl
      • charsio.pl
      • codesio.pl
      • coinduction.pl -- Co-Logic Programming
      • heaps.pl -- heaps/priority queues
      • statistics.pl -- Get information about resource usage
      • when.pl
      • backcomp.pl -- Backward compatibility
      • ctypes.pl -- Character code classification
      • check.pl
      • increval.pl -- Incremental dynamic predicate modification
      • tables.pl
      • shell.pl
      • thread.pl -- High level thread primitives
      • qpforeign.pl
      • listing.pl -- List programs and pretty print clauses
      • prolog_jiti.pl -- Just In Time Indexing (JITI) utilities
      • optparse.pl -- command line parsing
      • prolog_codewalk.pl -- Prolog code walker
      • fastrw.pl -- Fast reading and writing of terms
      • tableutil.pl -- Table inspection and statistics utilities
      • prolog_debug.pl -- User level debugging tools
      • portray_text.pl
      • prolog_coverage.pl -- Coverage analysis tool
      • system.pl
      • help.pl -- Text based manual
      • prolog_profile.pl
      • prolog_metainference.pl -- Infer meta-predicate properties
      • intercept.pl -- Intercept and signal interface
      • tty.pl
      • make.pl -- Reload modified source files
      • macros.pl
      • nb_set.pl
      • prolog_trace.pl
      • streams.pl -- Manage Prolog streams
      • rwlocks.pl
      • qsave.pl
      • zip.pl -- Access resource ZIP archives
      • edit.pl
      • prolog_qlfmake.pl -- Compile the library to QLF format
      • prolog_history.pl
      • prolog_autoload.pl
      • vm.pl
      • exceptions.pl -- Exception classification
      • oset.pl
      • writef.pl -- Old-style formatted write
      • check_installation.pl -- Check installation issues and features
      • hashtable.pl -- Hash tables
      • nb_rbtrees.pl -- Non-backtrackable operations on red black trees
      • readln.pl
      • files.pl
      • explain.pl -- Describe Prolog Terms
      • prolog_config.pl
      • prolog_deps.pl
      • pio.pl
 prolog:message_line_element(+Stream, +Term) is semidet[multifile, library(ansi_term)]
Hook implementation that colours the message elements produced by print_message_lines/3. Handled elements are:
ansi(Class, Fmt, Args)
ansi(Class, Fmt, Args, Ctx)
Write Fmt/Args using the attributes of Class. As the element ends with a full reset, the 4th argument version re-installs the decoration of the message as a whole afterwards.
url(Location)
url(URL, Label)
Write a hyperlink. See ansi_hyperlink/2,3. Label is an atom or string, a Format-Args pair or an ansi/3 or ansi/4 term. The latter combines a hyperlink with a style class.
begin(Class, Ctx)
end(Ctx)
Decorate the message as a whole. See below.
nl(Ctx),flush(Ctx)
End a line. If the message has a background colour, the remainder of the line is painted using `\e[K` (Erase in Line) such that the coloured block extends to the right margin.
eol(Ctx)
As above, but also reset the attributes: this ends the decorated part of the line. A message uses this for its last line if that line is not ended using nl. Resetting matters because a terminal that scrolls while a background colour is in effect paints the newly exposed line with it.

Ctx is the message context. It is created by the handler for begin/2 as a term

ansi(Reset, ReInstall, EraseEol)

where Reset is the sequence written by end/1, ReInstall is a Format-Args pair that re-installs the attributes of the message and EraseEol is the sequence that paints the remainder of the line or the empty atom. Callers must treat Ctx as opaque. It is left unbound if Stream is not a terminal, if the color_term flag is false or if the message has no attributes. All handlers that use Ctx therefore fail if it is unbound, which makes print_message_lines/3 fall back to writing plain text.