/usr/local/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 -- List Manipulation
      • broadcast.pl
      • shlib.pl -- Utility library for loading foreign objects (DLLs, shared objects)
      • option.pl -- Option list processing
      • thread_pool.pl
      • gensym.pl -- Generate unique symbols
      • settings.pl -- Setting management
      • arithmetic.pl -- Extensible arithmetic
      • main.pl -- Provide entry point for scripts
      • readutil.pl -- Read utilities
      • operators.pl -- Manage operators
      • pairs.pl -- Operations on key-value lists
      • prolog_source.pl -- Examine Prolog source-files
      • record.pl
      • predicate_options.pl -- Access and analyse predicate options
      • sandbox.pl
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • yall.pl -- Lambda expressions
      • assoc.pl
      • prolog_format.pl
      • quasi_quotations.pl -- Define Quasi Quotation syntax
      • pure_input.pl -- Pure Input from files and streams
      • solution_sequences.pl -- Modify solution sequences
      • ordsets.pl
      • random.pl
      • base64.pl -- Base64 encoding and decoding
      • aggregate.pl -- Aggregation operators on backtrackable predicates
      • csv.pl -- Process CSV (Comma-Separated Values) data
      • pprint.pl -- Pretty Print Prolog terms
      • atom.pl
      • 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 -- Lazy list handling
      • ugraphs.pl -- Graph manipulation library
      • url.pl -- Analysing and constructing URL
      • www_browser.pl -- Open a URL in the users browser
      • prolog_pack.pl -- A package manager for Prolog
      • git.pl -- Run GIT commands
      • utf8.pl -- UTF-8 encoding/decoding on lists of character codes.
      • dialect.pl -- Support multiple Prolog dialects
      • system.pl -- System utilities
      • terms.pl -- Term manipulation
      • date.pl -- Process dates and times
      • persistency.pl -- Provide persistent dynamic predicates
      • iostream.pl -- Utilities to deal with streams
      • prolog_stack.pl -- Examine the Prolog stack
      • edinburgh.pl -- Some traditional Edinburgh predicates
      • prolog_clause.pl
      • prolog_breakpoints.pl -- Manage Prolog break-points
      • wfs.pl
      • prolog_code.pl -- Utilities for reasoning about code
      • sort.pl
      • dicts.pl
      • dif.pl -- The dif/2 constraint
      • varnumbers.pl -- Utilities for numbered terms
      • pio.pl -- Pure I/O
      • hashtable.pl -- Hash tables
      • tty.pl -- Terminal operations
      • edit.pl -- Editor interface
      • fastrw.pl -- Fast reading and writing of terms
      • backcomp.pl -- Backward compatibility
      • statistics.pl -- Get information about resource usage
      • thread.pl -- High level thread primitives
      • base32.pl -- Base32 encoding and decoding
      • charsio.pl
      • codesio.pl -- I/O on Lists of Character Codes
      • coinduction.pl -- Co-Logic Programming
      • heaps.pl
      • rbtrees.pl
      • when.pl
      • ansi_term.pl -- Print decorated text to ANSI consoles
        • ansi_format/3
        • ansi_format/4
        • ansi_sgr/2
        • ansi_hyperlink/2
        • ansi_hyperlink/3
        • tty_url_hook/2
        • ansi_get_color/2
        • console_color/3
        • console_color/2
        • theme_base/2
        • message_line_element/2
      • nb_set.pl -- Non-backtrackable sets
      • listing.pl -- List programs and pretty print clauses
      • quintus.pl
      • strings.pl -- String utilities
      • ctypes.pl -- Character code classification
      • shell.pl -- Elementary shell commands
      • prolog_trace.pl -- Print access to predicates
      • prolog_coverage.pl -- Coverage analysis tool
      • rwlocks.pl -- Read/write locks
      • oset.pl -- Ordered set manipulation
      • make.pl
      • check.pl -- Consistency checking
      • explain.pl
      • prolog_codewalk.pl
      • prolog_metainference.pl -- Infer meta-predicate properties
      • optparse.pl -- command line parsing
      • prolog_debug.pl -- User level debugging tools
      • threadutil.pl -- Interactive thread utilities
      • prolog_versions.pl -- Demand specific (Prolog) versions
      • prolog_wrap.pl -- Wrapping predicates
      • tables.pl
      • increval.pl
      • streams.pl -- Manage Prolog streams
      • qsave.pl
      • zip.pl
      • prolog_history.pl -- Per-directory persistent commandline history
      • prolog_qlfmake.pl -- Compile the library to QLF format
      • intercept.pl
      • prolog_config.pl -- Provide configuration information
      • portray_text.pl -- Portray text
      • exceptions.pl
      • readln.pl
      • macros.pl -- Macro expansion
      • prolog_profile.pl -- Execution profiler
      • prolog_autoload.pl
      • writef.pl
      • prolog_jiti.pl -- Just In Time Indexing (JITI) utilities
 prolog:console_color(+Theme, +Term, -AnsiAttributes) is semidet[multifile, library(ansi_term)]
Hook that allows for mapping abstract terms to concrete ANSI attributes. This hook is used by theme files to adjust the rendering based on user preferences and context. Theme is the current theme: the value of the Prolog flag theme or, if no theme is selected, the theme of a loaded theme file. Defaults are defined in the file boot/messages.pl, default_theme/2.

Besides the classes used for messages (code, comment, var, warning, error, truth(Truth), port(Port), message(Kind), ...), the interactive toplevel uses these:

prompt
The ?- prompt and its `| ` continuation.
input
The text typed by the user at the prompt.
answer(Parity)
An answer written by the toplevel. Parity is odd or even and alternates over the answers of a single query, which allows for striping the answers using a background color. Only an answer that shows bindings, residual goals or delays uses this class: true. and false. are not answers to stripe, and neither is the empty line that separates the answer from the next query.
binding(name)
The variable name in a binding such as X = 1.

The debugger uses, besides frame(level) and port(Port):

goal(Port, Parity)
The goal of a frame reported for Port. Parity is odd or even and alternates over the steps of a trace, which allows for striping the goals using a background color. Match on Port to color the goal by port instead of (or in addition to) striping.

Note that a background color on prompt, input or answer(_) is painted up to the right margin using `\e[K`. A background on goal(_,_) is not: the debugger writes its ? prompt on the same line.

If Theme does not define Term, the theme it is based on is used (see prolog:theme_base/2).

See also
- library(theme/dark) for an example implementation and the Term values used by the system messages.