View source with formatted comments or as raw
    1/*  Part of SWI-Prolog
    2
    3    Author:        Jan Wielemaker
    4    E-mail:        J.Wielemaker@vu.nl
    5    WWW:           http://www.swi-prolog.org
    6    Copyright (c)  2019-2025, VU University Amsterdam
    7                              SWI-Prolog Solutions b.v.
    8    All rights reserved.
    9
   10    Redistribution and use in source and binary forms, with or without
   11    modification, are permitted provided that the following conditions
   12    are met:
   13
   14    1. Redistributions of source code must retain the above copyright
   15       notice, this list of conditions and the following disclaimer.
   16
   17    2. Redistributions in binary form must reproduce the above copyright
   18       notice, this list of conditions and the following disclaimer in
   19       the documentation and/or other materials provided with the
   20       distribution.
   21
   22    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   23    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   24    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   25    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   26    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   27    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   28    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   29    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   30    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   32    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   33    POSSIBILITY OF SUCH DAMAGE.
   34*/
   35
   36:- module(prolog_theme_dark, []).   37
   38/** <module> SWI-Prolog theme file -- dark
   39
   40To enable the dark theme, start Prolog using `swipl -Dtheme=dark` or
   41add the directive below to your init file.  Setting the flag loads
   42this file.
   43
   44    :- set_prolog_flag(theme, dark).
   45*/
   46
   47:- multifile
   48    prolog:theme/1,
   49    prolog:console_color/3,
   50    pldoc_style:theme/4.   51
   52prolog:theme(dark).                             % make ourselves known
   53
   54prolog:console_color(dark, Class, Attributes) :-
   55    console_color(Class, Attributes).
   56pldoc_style:theme(dark, Element, Condition, Attributes) :-
   57    pldoc_theme(Element, Condition, Attributes).
   58
   59		 /*******************************
   60		 *       PROLOG MESSAGES	*
   61		 *******************************/
   62
   63% code embedded in messages (not used much yet)
   64console_color(var,                    [hfg(cyan)]).
   65console_color(code,                   [hfg(yellow)]).
   66% Alert level
   67console_color(comment,                [hfg(green)]).
   68console_color(warning,                [fg(yellow)]).
   69console_color(error,                  [bold, fg(red)]).
   70% toplevel truth value (undefined for well founded semantics)
   71console_color(truth(false),           [bold, fg(red)]).
   72console_color(truth(true),            [bold]).
   73console_color(truth(undefined),       [bold, fg(cyan)]).
   74console_color(wfs(residual_program),  [fg(cyan)]).
   75% trace output
   76console_color(frame(level),           [bold]).
   77console_color(port(call),             [bold, fg(green)]).
   78console_color(port(exit),             [bold, fg(green)]).
   79console_color(port(fail),             [bold, fg(red)]).
   80console_color(port(redo),             [bold, fg(yellow)]).
   81console_color(port(unify),            [bold, fg(blue)]).
   82console_color(port(exception),        [bold, fg(magenta)]).
   83% the goal of successive steps alternates between two backgrounds, which
   84% separates the steps of a trace.  The first argument is the port, which
   85% allows for colouring the goal by port instead of (or in addition to)
   86% striping.
   87console_color(goal(_, odd),           [hfg(yellow), bg8(238)]).
   88console_color(goal(_, even),          [hfg(yellow), bg8(240)]).
   89% interactive toplevel.  The command line (prompt and the text typed by
   90% the user) has its own background.  The answers to a single query
   91% alternate between two backgrounds, which separates the answers of a
   92% non-deterministic query.
   93console_color(prompt,                 [bold, fg8(h(cyan)), bg8(21)]).
   94console_color(input,                  [bg8(21)]).
   95console_color(answer(odd),            [bg8(238)]).
   96console_color(answer(even),           [bg8(240)]).
   97console_color(binding(name),          [bold, fg8(h(yellow))]).
   98% tag that indicates the kind of a predicate in a list of candidates.
   99console_color(predicate(iso),         [italic, hfg(cyan)]).
  100console_color(predicate(built_in),    [italic, hfg(cyan)]).
  101console_color(predicate(foreign),     [italic, hfg(cyan)]).
  102console_color(predicate(library(_)),  [italic, hfg(green)]).
  103console_color(predicate(module(_)),   [italic, hfg(green)]).
  104console_color(predicate(user),        [italic, fg(default)]).
  105console_color(predicate(undefined),   [italic, fg(red)]).
  106% print message. the argument for debug(_) is the debug channel.
  107console_color(message(informational), [hfg(green)]).
  108console_color(message(information),   [hfg(green)]).
  109console_color(message(debug(_)),      [hfg(yellow)]).
  110console_color(message(Level),         Attrs) :-
  111    nonvar(Level),
  112    console_color(Level, Attrs).
  113
  114		 /*******************************
  115		 *          ONLINE HELP		*
  116		 *******************************/
  117
  118%!  pldoc_theme(+Element, +Condition, -CSSAttributes) is semidet.
  119%
  120%   Return a set of CSS properties to modify on the specified Element if
  121%   Condition   holds.   color(Name)   is   mapped   to   fg(Name)   and
  122%   color(bright_Name) to hfg(Name).
  123
  124pldoc_theme(var,  true,                  [color(bright_cyan)]).
  125pldoc_theme(code, true,                  [color(bright_yellow)]).
  126pldoc_theme(pre,  true,                  [color(bright_yellow)]).
  127pldoc_theme(p,    class(warning),        [color(yellow)]).
  128pldoc_theme(span, class('synopsis-hdr'), [color(bright_green)]).
  129pldoc_theme(span, class(autoload),       [color(bright_green)]).
  130
  131		 /*******************************
  132		 *           IDE TOOLS		*
  133		 *******************************/
  134
  135:- multifile
  136    pce_theme:colour/3.  137
  138pce_theme:colour(dark, Name, Value) :-
  139    colour(Name, Value).
  140
  141%!  colour(?Name, ?Value)
  142%
  143%   Values for the semantic colours of xpce in the dark theme.  See
  144%   library(pce_theme).  The `syntax_*` colours are used by PceEmacs
  145%   to highlight the syntax classes of library(prolog_colour).  For
  146%   example, `syntax_goal_built_in` is the colour for goal(built_in,_).
  147%   After making modifications, run ``?- make.`` and
  148%   ``?- apply_theme(dark).`` to see the effect.  Use
  149%   ``?- check_theme(dark).`` to verify the coverage.
  150
  151% Basic colours.  These replace the system colours if the system
  152% colours are light, i.e., for using the dark theme on a light desktop.
  153
  154colour(ui_window_background,            '#1e1e1e').
  155colour(ui_window_foreground,            white).
  156colour(ui_dialog_background,            '#2b2b2b').
  157colour(ui_dialog_foreground,            white).
  158colour(ui_button_background,            '#3c3c3c').
  159colour(ui_button_foreground,            white).
  160colour(ui_button_pressed,               '#505050').
  161colour(ui_selection_background,         '#0078d4').
  162colour(ui_selection_foreground,         white).
  163colour(ui_tooltip_background,           '#2b2b2b').
  164colour(ui_tooltip_foreground,           white).
  165colour(ui_inactive,                     '#8a8a8a').
  166colour(ui_link,                         '#60cdff').
  167colour(ui_accent,                       '#0078d4').
  168colour(ui_separator,                    '#454545').
  169colour(ui_shadow,                       '#101010').
  170
  171% Derived colours
  172
  173colour(ui_margin_background,            ui_window_background).
  174colour(ui_scrollbar_background,         ui_dialog_background).
  175colour(ui_tile_gap,                     ui_dialog_background).
  176colour(ui_tile_border,                  ui_dialog_background).
  177colour(ui_tile_separator,               ui_window_foreground).
  178
  179% Text.  Selection and search backgrounds are dark, such that the
  180% (syntax) colours of the text remain readable.
  181
  182colour(ui_text_selection_background,    '#264f78').
  183colour(ui_isearch_background,           '#806000').
  184colour(ui_isearch_other_background,     '#2f4f4f').
  185colour(ui_isearch_failed_background,    '#8b1a1a').
  186colour(ui_code_background,              '#6e768166').
  187colour(ui_fold,                         grey60).
  188colour(ui_cursor,                       firebrick1).
  189colour(ui_cursor_inactive,              grey50).
  190
  191% Dialog items
  192
  193colour(ui_placeholder,                  grey50).
  194colour(ui_accelerator,                  grey70).
  195colour(ui_danger,                       '#f14c4c').
  196colour(ui_danger_foreground,            white).
  197colour(ui_error,                        '#f14c4c').
  198colour(ui_warning,                      '#cca700').
  199
  200% Epilog terminal ANSI colours
  201
  202colour(ansi_black,                      black).
  203colour(ansi_red,                        firebrick1).
  204colour(ansi_green,                      forestgreen).
  205colour(ansi_yellow,                     goldenrod).
  206colour(ansi_blue,                       steelblue).
  207colour(ansi_magenta,                    mediumorchid).
  208colour(ansi_cyan,                       darkturquoise).
  209colour(ansi_white,                      lightgray).
  210colour(ansi_bright_black,               gray40).
  211colour(ansi_bright_red,                 orangered).
  212colour(ansi_bright_green,               limegreen).
  213colour(ansi_bright_yellow,              khaki).
  214colour(ansi_bright_blue,                dodgerblue).
  215colour(ansi_bright_magenta,             violet).
  216colour(ansi_bright_cyan,                cyan).
  217colour(ansi_bright_white,               snow).
  218
  219% Debugger.  The port colours are backgrounds for the current line in
  220% the source view.
  221
  222colour(debug_port_call,                 '#1e4620').
  223colour(debug_port_break,                '#1e4a4a').
  224colour(debug_port_exit,                 '#1e4620').
  225colour(debug_port_redo,                 '#5c5000').
  226colour(debug_port_fail,                 '#6a2020').
  227colour(debug_port_exception,            '#4a1e4a').
  228colour(debug_port_unify,                '#1e3a5c').
  229colour(debug_port_choice,               '#5c5000').
  230colour(debug_port_frame,                '#4a4a1e').
  231colour(debug_inactive_background,       grey50).
  232colour(debug_enabled_background,        '#1e5a1e').
  233
  234% Profiler
  235
  236colour(prof_header_background,          khaki3).
  237colour(prof_node,                       dodger_blue).
  238
  239% Cross referencer
  240
  241colour(xref_node_background,            grey35).
  242colour(xref_node_foreground,            white).
  243colour(xref_predicate,                  green).
  244colour(xref_autoload,                   steel_blue).
  245colour(xref_global,                     steel_blue).
  246colour(xref_undefined,                  tomato).
  247colour(xref_not_called,                 tomato).
  248colour(xref_header_foreground,          black).
  249colour(xref_header_background,          khaki3).
  250
  251% Thread monitor
  252
  253colour(thread_graph_local,              dodger_blue).
  254colour(thread_graph_global,             orange).
  255colour(thread_graph_trail,              lime_green).
  256colour(thread_graph_tables,             tomato).
  257colour(thread_graph_cpu,                orchid).
  258colour(thread_graph_incomplete,         deep_pink).
  259colour(thread_graph_scc_ratio,          gold).
  260colour(thread_cpu_idle,                 grey30).
  261colour(thread_cpu_busy,                 lime_green).
  262
  263% Symbol picker
  264
  265colour(symbol_picker_user,              light_green).
  266colour(symbol_picker_prolog,            light_sky_blue).
  267
  268% PceEmacs bookmarks and the help viewer
  269
  270colour(emacs_bookmark_hit,              '#806000').
  271colour(emacs_bookmark_filter,           '#1f4e79').
  272colour(help_link,                       deep_sky_blue).
  273
  274% PceEmacs syntax highlighting
  275
  276colour(syntax_goal_built_in,            cyan).
  277colour(syntax_goal_imported,            cyan).
  278colour(syntax_goal_autoload,            dark_cyan).
  279colour(syntax_goal_global,              dark_cyan).
  280colour(syntax_goal_global_dynamic,      magenta).
  281colour(syntax_goal_undefined,           orange).
  282colour(syntax_goal_thread_local,        magenta).
  283colour(syntax_goal_dynamic,             magenta).
  284colour(syntax_goal_multifile,           pale_green).
  285colour(syntax_goal_expanded,            cyan).
  286colour(syntax_goal_extern,              cyan).
  287colour(syntax_goal_extern_private,      red).
  288colour(syntax_goal_extern_public,       cyan).
  289colour(syntax_goal_meta,                red4).
  290colour(syntax_goal_foreign,             darkturquoise).
  291colour(syntax_goal_constraint,          darkcyan).
  292colour(syntax_goal_not_callable_bg,     orange).
  293
  294colour(syntax_function,                 cyan).
  295colour(syntax_no_function,              orange).
  296
  297colour(syntax_option_name,              dodgerblue).
  298colour(syntax_no_option_name,           orange).
  299
  300colour(syntax_head_exported,            cyan).
  301colour(syntax_head_public,              '#016300').
  302colour(syntax_head_extern,              cyan).
  303colour(syntax_head_dynamic,             magenta).
  304colour(syntax_head_multifile,           pale_green).
  305colour(syntax_head_unreferenced,        red).
  306colour(syntax_head_hook,                cyan).
  307colour(syntax_head_constraint,          darkcyan).
  308colour(syntax_head_imported,            darkgoldenrod4).
  309colour(syntax_head_built_in_bg,         orange).
  310colour(syntax_head_iso_bg,              orange).
  311colour(syntax_head_def_iso,             cyan).
  312colour(syntax_head_def_swi,             cyan).
  313colour(syntax_head_test,                '#01bdbd').
  314colour(syntax_rule_condition_bg,        darkgreen).
  315
  316colour(syntax_module,                   light_slate_blue).
  317colour(syntax_comment,                  green).
  318
  319colour(syntax_directive_bg,             grey20).
  320
  321colour(syntax_var,                      orangered1).
  322colour(syntax_singleton,                orangered1).
  323colour(syntax_unbound,                  red).
  324colour(syntax_quoted_atom,              pale_green).
  325colour(syntax_string,                   pale_green).
  326colour(syntax_rational,                 light_steel_blue).
  327colour(syntax_codes,                    pale_green).
  328colour(syntax_chars,                    pale_green).
  329colour(syntax_nofile,                   red).
  330colour(syntax_file,                     cyan).
  331colour(syntax_file_no_depend,           cyan).
  332colour(syntax_file_no_depend_bg,        dark_violet).
  333colour(syntax_directory,                cyan).
  334colour(syntax_class_built_in,           cyan).
  335colour(syntax_class_library,            pale_green).
  336colour(syntax_class_undefined,          red).
  337colour(syntax_prolog_data,              cyan).
  338colour(syntax_flag_name,                cyan).
  339colour(syntax_known_flag_name,          cyan).
  340colour(syntax_known_flag_name_bg,       maroon).
  341colour(syntax_no_flag_name,             red).
  342colour(syntax_unused_import,            cyan).
  343colour(syntax_unused_import_bg,         maroon).
  344colour(syntax_undefined_import,         red).
  345
  346colour(syntax_constraint,               darkcyan).
  347
  348colour(syntax_keyword,                  cyan).
  349colour(syntax_expanded,                 cyan).
  350colour(syntax_hook,                     cyan).
  351colour(syntax_macro,                    cyan).
  352colour(syntax_op_type,                  cyan).
  353
  354colour(syntax_qq,                       cyan).
  355colour(syntax_qq_content,               coral2).
  356
  357colour(syntax_dict_function,            pale_green).
  358colour(syntax_dict_return_op,           cyan).
  359
  360colour(syntax_dcg_right_hand_ctx_bg,    '#609080').
  361
  362colour(syntax_error_bg,                 orange).
  363colour(syntax_type_error_bg,            orange).
  364colour(syntax_domain_error_bg,          orange).
  365colour(syntax_syntax_error_bg,          orange).
  366colour(syntax_instantiation_error_bg,   orange)