Noob question about the SWI-Prolog app on macOS 15.4

I’ve just installed SWI-Prolog from source using the docs at Building SWI-Prolog on MacOSX. It seems to have gone without error. However, the colors of the opening screen are not exactly pleasant to use…

Is there a simple way to set the foreground and background colors to consistent settings, rather than black on white with a black surround ? :open_mouth:

I’ve loaded up the GUI preferences in X11, but I can’t see any obvious way of making the changes I want.

Any ideas, anyone? :folded_hands:

I sorted out the colors…

  1. I went into the Info.plist at /Applications/swipl-win.app/Contents/Info.plist and edited the Bundle identifier from a blank to become org.swi-prolog.
  2. I then, at the command line, ran defaults write org.swi-prolog NSRequiresAquaSystemAppearance -bool yes

It’s a bit bright but it’s aesthetically acceptable now.

Now for the font, but I think I can do that in the GUI config in X11…

1 Like

Okay! I give up… How do I change the fonts? I’ve tried this in X11…

display.system_fonts:	[ normal    := font(helvetica, roman,   16), \
			  bold      := font(helvetica, bold,    16), \
			  italic    := font(helvetica, oblique, 16), \
			  small     := font(helvetica, roman,   14), \
			  large     := font(helvetica, roman,   18), \
			  boldlarge := font(helvetica, bold,    18), \
			  huge      := font(helvetica, roman,   22), \
			  boldhuge  := font(helvetica, bold,    22), \
			  fixed     := font(screen,    roman,   16, 'Monofur Nerd Font'), \
			  tt        := font(screen,    roman,   16, 'Monofur Nerd Font'), \
			  boldtt    := font(screen,    bold,    16, 'Monofur Nerd Font'), \
			  symbol    := font(symbol,    roman,   12)  \
			]

but it doesn’t seem to be recognized…

I don’t know. What I do know is that the “app” is a Qt application that has no relation to xpce, so no wonder changing xpce fonts won’t help. They affect the fonts of the IDE tools such as the graphical tracer and editor.

It seems win_window_color/2 does work on the swipl-win console. You can put that in your ~/.config/swi-prolog/init.pl

Thanks for the reply! When I say “I’ve tried this in X11”, I mean that I’ve changed the setting that appear when I select Settings -> GUI preferences from the SWI-Prolog console.

Any idea where I can find out about what should go in ~/.config/swi-prolog/init.pl? I tried searching…

I noticed that changing the colour of the background indeed leads to the ugly result you showed for the text already displayed, but new text works fine. Maybe after restarting it works fine?

Anything Prolog can eat. It is just a Prolog file that is loaded early in the startup phase. You can use Setting/User init file from the console menu to edit it. If I recall well, if there is none it copies a demo file with some common settings commented out before editing.

Typically, you mostly set Prolog flags using set_prolog_flag/2. Also nice is

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

if you like a dark display.

I see that the final . is significant, and is not just you being grammatically correct in your reply :wink:

Again, forgive me for the basic nature of my questions!
Following the docs at SWI-Prolog -- Environment Control (Prolog flags)
I’ve added… :- editor('zed dev', '/Applications/Zed Dev.app'). to my init.pl, but when I restart, I’m getting the error…

ERROR: /Users/carlcaulkett/.config/swi-prolog/init.pl:2:
ERROR:    catch/3: Unknown procedure: editor/2
Warning: /Users/carlcaulkett/.config/swi-prolog/init.pl:2:
Warning:    Goal (directive) failed: user:editor('zed dev','/Applications/Zed Dev.app')

All begin is hard :slight_smile: Flags are set using the predicate set_prolog_flag/2, e.g.,

:- set_prolog_flag(editor, zed).

Now, it doesn’t know this thing, so you probably also need to tell Prolog how to call this. That is a little complicated

:- multifile prolog_edit:edit_command/2.
prolog_edit:edit_command(zed, '/Applications/Zed Dev.app +%d %f').

Now, if it tries to open foo.pl at line 42, Prolog will try to run

/Applications/Zed Dev.app +42 "foo.pl"

Adjust as needed to direct it to the selected line (the +42 is what e.g., GNU Emacs uses).

The built-in editor emulates Emacs. It is probably hard to use if you are not an Emacs user. It does do proper indentation and for novices may be more important, full syntax checking and detailed highlighting.