View source with raw 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, VU University Amsterdam
    7    All rights reserved.
    8
    9    Redistribution and use in source and binary forms, with or without
   10    modification, are permitted provided that the following conditions
   11    are met:
   12
   13    1. Redistributions of source code must retain the above copyright
   14       notice, this list of conditions and the following disclaimer.
   15
   16    2. Redistributions in binary form must reproduce the above copyright
   17       notice, this list of conditions and the following disclaimer in
   18       the documentation and/or other materials provided with the
   19       distribution.
   20
   21    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   22    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   23    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   24    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   25    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   26    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   27    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   28    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   29    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   30    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   31    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   32    POSSIBILITY OF SUCH DAMAGE.
   33*/
   34
   35:- module(prolog_theme_dark, []).

SWI-Prolog theme file -- dark

To enable the dark theme, use

:- use_module(library(theme/dark)).

*/

   44:- multifile
   45    prolog:theme/1,
   46    prolog:console_color/2,
   47    pldoc_style:theme/3.   48
   49prolog:theme(dark).                             % make ourselves known
   50
   51:- if(current_predicate(win_window_color/2)).   52set_window_colors :-
   53    win_window_color(background, rgb(0,0,0)),
   54    win_window_color(foreground, rgb(255,255,255)),
   55    win_window_color(selection_background, rgb(0,255,255)),
   56    win_window_color(selection_foreground, rgb(0,0,0)).
   57
   58:- initialization
   59    set_window_colors.   60:- endif.   61
   62		 /*******************************
   63		 *       PROLOG MESSAGES	*
   64		 *******************************/
   65
   66% code embedded in messages (not used much yet)
   67prolog:console_color(var,                    [hfg(cyan)]).
   68prolog:console_color(code,                   [hfg(yellow)]).
   69% Alert level
   70prolog:console_color(comment,                [hfg(green)]).
   71prolog:console_color(warning,                [fg(yellow)]).
   72prolog:console_color(error,                  [bold, fg(red)]).
   73% toplevel truth value (undefined for well founded semantics)
   74prolog:console_color(truth(false),           [bold, fg(red)]).
   75prolog:console_color(truth(true),            [bold]).
   76prolog:console_color(truth(undefined),       [bold, fg(cyan)]).
   77prolog:console_color(wfs(residual_program),  [fg(cyan)]).
   78% trace output
   79prolog:console_color(frame(level),           [bold]).
   80prolog:console_color(port(call),             [bold, fg(green)]).
   81prolog:console_color(port(exit),             [bold, fg(green)]).
   82prolog:console_color(port(fail),             [bold, fg(red)]).
   83prolog:console_color(port(redo),             [bold, fg(yellow)]).
   84prolog:console_color(port(unify),            [bold, fg(blue)]).
   85prolog:console_color(port(exception),        [bold, fg(magenta)]).
   86% print message. the argument for debug(_) is the debug channel.
   87prolog:console_color(message(informational), [hfg(green)]).
   88prolog:console_color(message(information),   [hfg(green)]).
   89prolog:console_color(message(debug(_)),      [hfg(yellow)]).
   90prolog:console_color(message(Level),         Attrs) :-
   91    nonvar(Level),
   92    prolog:console_color(Level, Attrs).
   93
   94
   95		 /*******************************
   96		 *          ONLINE HELP		*
   97		 *******************************/
 pldoc_style:theme(+Element, +Condition, -CSSAttributes) is semidet
Return a set of CSS properties to modify on the specified Element if Condition holds. color(Name) is mapped to fg(Name) and color(bright_Name) to hfg(Name).
  105pldoc_style:theme(var,  true,                  [color(bright_cyan)]).
  106pldoc_style:theme(code, true,                  [color(bright_yellow)]).
  107pldoc_style:theme(pre,  true,                  [color(bright_yellow)]).
  108pldoc_style:theme(p,    class(warning),        [color(yellow)]).
  109pldoc_style:theme(span, class('synopsis-hdr'), [color(bright_green)]).
  110pldoc_style:theme(span, class(autoload),       [color(bright_green)]).
  111
  112
  113		 /*******************************
  114		 *           IDE TOOLS		*
  115		 *******************************/
  116
  117:- multifile
  118    pce:on_load/0,
  119    prolog_colour:style/2.  120
  121prolog_colour:style(Class, Style) :-
  122    style(Class, Style).
 style(+Class, -Style)
Map style classes defined in library(prolog_colour) to xpce style objects. After making modifications the effect can be tested without restarting using this sequence:
  1. Run ?- make in Prolog
  2. In the editor, use M-x reload_styles
  133style(goal(built_in,_),          [colour(cyan)]).
  134style(goal(imported(_),_),       [colour(cyan)]).
  135style(goal(autoload(_),_),       [colour(dark_cyan)]).
  136style(goal(global,_),            [colour(dark_cyan)]).
  137style(goal(undefined,_),         [colour(orange)]).
  138style(goal(thread_local(_),_),   [colour(magenta), underline(true)]).
  139style(goal(dynamic(_),_),        [colour(magenta)]).
  140style(goal(multifile(_),_),      [colour(pale_green)]).
  141style(goal(expanded,_),          [colour(cyan), underline(true)]).
  142style(goal(extern(_),_),         [colour(cyan), underline(true)]).
  143style(goal(extern(_,private),_), [colour(red)]).
  144style(goal(extern(_,public),_),  [colour(cyan)]).
  145style(goal(recursion,_),         [underline(true)]).
  146style(goal(meta,_),              [colour(red4)]).
  147style(goal(foreign(_),_),        [colour(darkturquoise)]).
  148style(goal(local(_),_),          []).
  149style(goal(constraint(_),_),     [colour(darkcyan)]).
  150style(goal(not_callable,_),      [background(orange)]).
  151
  152style(function,                  [colour(cyan)]).
  153style(no_function,               [colour(orange)]).
  154
  155style(option_name,               [colour('#3434ba')]).
  156style(no_option_name,            [colour(orange)]).
  157
  158style(head(exported,_),          [colour(cyan), bold(true)]).
  159style(head(public(_),_),         [colour('#016300'), bold(true)]).
  160style(head(extern(_),_),         [colour(cyan), bold(true)]).
  161style(head(dynamic,_),           [colour(magenta), bold(true)]).
  162style(head(multifile,_),         [colour(pale_green), bold(true)]).
  163style(head(unreferenced,_),      [colour(red), bold(true)]).
  164style(head(hook,_),              [colour(cyan), underline(true)]).
  165style(head(meta,_),              []).
  166style(head(constraint(_),_),     [colour(darkcyan), bold(true)]).
  167style(head(imported(_),_),       [colour(darkgoldenrod4), bold(true)]).
  168style(head(built_in,_),          [background(orange), bold(true)]).
  169style(head(iso,_),               [background(orange), bold(true)]).
  170style(head(def_iso,_),           [colour(cyan), bold(true)]).
  171style(head(def_swi,_),           [colour(cyan), bold(true)]).
  172style(head(_,_),                 [bold(true)]).
  173
  174style(module(_),                 [colour(light_slate_blue)]).
  175style(comment(_),                [colour(green)]).
  176
  177style(directive,                 [background(grey20)]).
  178style(method(_),                 [bold(true)]).
  179
  180style(var,                       [colour(orangered1)]).
  181style(singleton,                 [bold(true), colour(orangered1)]).
  182style(unbound,                   [colour(red), bold(true)]).
  183style(quoted_atom,               [colour(pale_green)]).
  184style(string,                    [colour(pale_green)]).
  185style(codes,                     [colour(pale_green)]).
  186style(chars,                     [colour(pale_green)]).
  187style(nofile,                    [colour(red)]).
  188style(file(_),                   [colour(cyan), underline(true)]).
  189style(file_no_depend(_),         [colour(cyan), underline(true),
  190                                  background(dark_violet)]).
  191style(directory(_),              [colour(cyan)]).
  192style(class(built_in,_),         [colour(cyan), underline(true)]).
  193style(class(library(_),_),       [colour(pale_green), underline(true)]).
  194style(class(local(_,_,_),_),     [underline(true)]).
  195style(class(user(_),_),          [underline(true)]).
  196style(class(user,_),             [underline(true)]).
  197style(class(undefined,_),        [colour(red), underline(true)]).
  198style(prolog_data,               [colour(cyan), underline(true)]).
  199style(flag_name(_),              [colour(cyan)]).
  200style(no_flag_name(_),           [colour(red)]).
  201style(unused_import,             [colour(cyan), background(pink)]).
  202style(undefined_import,          [colour(red)]).
  203
  204style(constraint(_),             [colour(darkcyan)]).
  205
  206style(keyword(_),                [colour(cyan)]).
  207style(identifier,                [bold(true)]).
  208style(delimiter,                 [bold(true)]).
  209style(expanded,                  [colour(cyan), underline(true)]).
  210style(hook(_),                   [colour(cyan), underline(true)]).
  211style(op_type(_),                [colour(cyan)]).
  212
  213style(qq_type,                   [bold(true)]).
  214style(qq(_),                     [colour(cyan), bold(true)]).
  215style(qq_content(_),             [colour(red4)]).
  216
  217style(dict_tag,                  [bold(true)]).
  218style(dict_key,                  [bold(true)]).
  219style(dict_function(_),          [colour(pale_green)]).
  220style(dict_return_op,            [colour(cyan)]).
  221
  222style(hook,                      [colour(cyan), underline(true)]).
  223style(dcg_right_hand_ctx,        [background('#609080')]).
  224
  225style(error,                     [background(orange)]).
  226style(type_error(_),             [background(orange)]).
  227style(syntax_error(_,_),         [background(orange)]).
  228style(instantiation_error,       [background(orange)]).
  229
  230style(table_option(_),           [bold(true)]).
  231style(table_mode(_),             [bold(true)]).
  232
  233
  234		 /*******************************
  235		 *         GUI DEFAULTS		*
  236		 *******************************/
  237
  238:- op(200, fy,  @).  239:- op(800, xfx, :=).  240
  241pce:on_load :-
  242    pce_set_defaults.
  243
  244pce_set_defaults :-
  245    pce_style(Class, Properties),
  246    member(Prop, Properties),
  247    Prop =.. [Name,Value],
  248    term_string(Value, String),
  249    send(@default_table, append, Name, vector(Class, String)),
  250    fail ; true.
 pce_style(+Class, -Attributes)
Set XPCE class variales for Class. This is normally done by loading a resource file, but doing it from Prolog keeps the entire theme in a single file.
  258% PceEmacs
  259
  260pce_style(text_image,
  261          [ background(black),
  262            colour(white)
  263          ]).
  264pce_style(text_margin,
  265          [ background(grey20)
  266          ]).
  267pce_style(editor,
  268          [ selection_style(style(background := yellow, colour := black)),
  269            isearch_style(style(background := green, colour := black)),
  270            isearch_other_style(style(background := pale_turquoise,
  271                                      colour := black))
  272          ]).
  273
  274% Graphical debugger
  275
  276pce_style(prolog_stack_view,
  277          [ background(black)
  278          ]).
  279pce_style(prolog_stack_frame,
  280          [ background(black),
  281            colour(white)
  282          ]).
  283pce_style(prolog_stack_link,
  284          [ colour(white)
  285          ]).
  286pce_style(prolog_bindings_view,
  287          [ background_active(black),
  288            background_inactive(grey50)
  289          ]).
 prolog_source_view:port_style(+Port, -StyleAttributes)
Override style attributes for indicating a specific port in the source view. Ports are: call, break, exit, redo, fail, exception, unify, choice, `frame and breakpoint.
  297:- multifile
  298    prolog_source_view:port_style/2.  299
  300prolog_source_view:port_style(call, [background(forest_green), colour(black)]).
  301prolog_source_view:port_style(fail, [background(indian_red),   colour(black)]).
  302prolog_source_view:port_style(_,    [colour(black)])