Lexing Plugin version 4.0.0 is available at

MacOS Mojave (macOS 10.14) uses semantic colors, as does windows-10, to adapt to light or dark mode. To set up this LexingControl, that at its base uses colors for syntax highlighting, the plugin defines two additional classes, providing semantic (catalog) colors for light-dark mode awarenesses.

Setting up the Lexing control in the Xojo IDE is easy. The color types for fore and back colors of text and line numbers, the caret color and other marginView colors in the IDE is replaced as Integer-enumerations as seen by the popups. They indicate the semantic or catalog colors.

Yet these properties can take colors when cast to a UInt32 data type.

To support the theme changes, Lexing control comes with two novel events: “ThemeChange() as Boolean” and “ThemeSetup() as Boolean”.

Instead of setting up coloring in the Open event, you should move your code to the ThemeSetup event and call coloring in the ThemeChange event.

Accompanied with this plugin are two data-type classes, XSColor and its subclass SemanticColor. XSColor is a cross-platform approach, while the SemanticColor type is specific for macOS and windows. While there are other sources, such as CSTrueColors, it would be worth checking out our implementation.

Given LexingControl with XSColor and SemanticColor, supporting light and dark mode on macOS and high-contrast on windows with the ability to color text in ways you might not imagine, we suggest to download the demo version of this novel plugin. Those who have a license for the previous version can request the upgrade discount.

Check it out. Development of the LexingControl rested heavily on the creation of the XSColor and SemanticColor classes and the subsequent creation of a sample project that grouped the colors in categories. This helped also in the sublimation of the color type as 0xFFAACCDD into an Integer. LexingControl in the IDE may be a good example of how Xojo controls could be visually improved in design time when it comes to assigning colors, while abandoning the rule to set colors to black to support catalog/named colors.

Alfred van Hoek

An updated version is available at

November 2018 - February 2019
A major overhaul, not necessarily breaking existing code, has been necessary with respect to assigning colors. If one encounters a compiler error “expected color” but got “Integer”, cast the “integer” to a UInt32 type, which is compatible with the type “Color”.

To provide support to the LexingControl, XSColor data type (now inherits XSColorControl) and its companion SemanticColor (subclass of XSColor) provide a number of shared methods to access the catalog (named) colors that are semantic and change their appearances between dark-mode/high-contrast and light-mode/turned-off-high-contrast.

These colors are used in the LexingControl as enumerated colors (Integer-type), while in code you can assign any other hard-code colors when cast to the UInt32 type.

XSColor and SemanticColor, introduced in January 2019, has been expanded by the XSColorControl to provide composite and blending features based on and defined by

These are:
/* Porter-Duff compositing operations /
/ */

/* Separable blend-modes */
/* [url=][/url] */

/* Non-separable blend-modes */
/* [url=][/url] */

A project based on these features has been developed and comes with the current plugin:

LexingControl underwent further improvements and some changes for optimization and look and feel. Documentation still need updates, but the sample projects should provide for the current lack of it.
To obtain info of the list of classes, controls, properties, methods, enumerations, navigate to the help menu in the Xojo IDE and choose plugins, provided you have installed the plugin in the plugins folder of Xojo.

The plugin is compatible with macOS 10.12 and higher, macOS 10.14 is recommended (and also in 32-bit mode). The plugin is also high-contrast aware on windows 7 and higher, while windows 10 is recommended. Note that Xojo is currently very limited in displaying its controls on windows-high-contrast, and therefore the new sample project looks quite bad with high-contrast.

@Alfred - Your link is taking us to an unconfigured web page…



I feel I should know, but:
What is it for?

Primarily an editor control with syntax color coding. A few other goodies, as well.

[quote=423845:@Jeff Tullin]I feel I should know, but:
What is it for?[/quote]
The plugin comes with the LexingControl, which is an editor that is different from the usual editors. Usual editors allow for justification of text, but are limited when it comes to create code-editing features.

LexingControl provide syntax coloring of code for over 100 different languages, allows the display of line numbers and above all provide necessary coloring of words depending on the language used. You can also customize LexingControl by implementing your own way of coloring.

In addition to LexingControl, and with the advent of dark and light modes for macOS 10.14 (and high-contrast for windows 10), new classes come with the plugin, specifically designed to let colors change when the appearance of a windows or macOS is changed at the system level. Hard-coded colors have become something of the past. They now should be defined as semantic colors. XSColor and its companions provide these semantic colors primarily for use with the LexingControl, but can easily be used for other purposes at your liking.

Checkout two projects that comes with the plugin that don’t use the LexingControl.


Version 4.1.0 of the Lexing Plugin is available .

This version comes with a new control: XSViewController (macOS-only) and is currently a free-add0n to this plugin. The nag-free controller allows views in a popover window in the easiest form you can imagine. Click-dragging the popover detaches it from a button edge, the window becomes key and interaction with what ever widget is possible and allowed.

Each instance of XSViewController provides a popover/detached window as shown here:

The workings of this new control (XSViewController) is two-fold: Use the boxView, the default view attached to the XSViewController as the design environment, or use the open event of the controller to assign rectControl like

dim CXC as new ContainedXSColor CXC.EmbedWithin window1 me.controlHandle = CXC.Handle
where “me” means the instance of a XSViewController, and voila, the box isn’t involved, you’ve got your popover/detached window with your widgets. Declares are not involved, whereas macoslib, for example does not do detachment. Detached windows can be set dark-mode aware:

The background of the popover/detached window follows vibrancy appearances that can be set fixed if you would want to. Furthermore, a number of instances of XSViewController can be used and called. If not detached, one popover a time is possible, but when detached multiple different windows (HUD or window) and their modifications is supported.

If you are interested, find the sample project “ShowOver” and check it out.

Release notes:
February 23, 2019
Added grayscale and sepia to the XSColorControl.

February 6, 2019
Fixed a color issue for the LexingControl on windows that was introduced in version 4.0.1.
Fixed a backspace issue on macOS that spuriously removed two characters a time.
Added more documentation.

A bunch of macOS light-dark aware controls

Happy to introduce the XSClasses (controls and controller) in a new plugin for the macOS platform (10.12 and higher). We introduced the XSViewController (popOver) in the LexingControl plugin and have added some additional features to this controller and renamed it the XSLayoutController to better reflect its use and capabilities.

The one liner description of the plugin is:

“A light-dark aware controller to capture and expose a Xojo layout in a popUp window (the XSLayoutController), with supporting Calendar, Date, Clock and Time viewers, and a contentTint Button for the macOS platform”

The XSLayoutController’s default box view can now be customized by color, corner shape and margins. Of particular interest is the XSButton (a native macOS control) different from the native button controls that Xojo exposes. XSButton allows a hover highlight of text or bezel.

An upcoming LexingControl version will not have the XSViewController (which is a freeware controller). The XSClasses plugin comes as a pro-version (not expensive), while you can try out the XSClasses with the demo (a full fledged pro-version, but with a nagging window when used in a build).

Scripts Plugin version 3.1 has been out and comes with added another thread-safe class to sequentially run a thread with the mainThread in “synchronous” fashion. It is called the “ThreadedTimer” of which its workings are derived from the ThreadsafeGUIProcessor. It services the thread and the mainThread and has four events: “ServiceThread”, “ServiceMainThread”, “ServiceEnding” and “ServiceEnd”. Several related projects to this class have been developed and provided with this download.

About the Scripts plugin:
This is a multifunctional plugin. It encapsulates XojoScript and stringifies Xojo framework methods and properties. Stringified methods are defined in the ContextProcessor class, which can be presented as

  1. a XojoScript context allowing a script to have access to the whole Xojo framework.
    a helper class to allow creation of GUI elements and handlers on the fly.

Basic is another class defined in this plugin. It has a different syntax than Xojo/XojoScript, it has helper classes to provide a context. Thus it has similar capabilities. Currently, it only recognizes the methods in your context class.

Threadsafe is the goto class if you need to make your thread to access the GUI. It is very simple to use.
If you have a call like StartButton.enabled = false, you can replace it with myThreadSafe.BooleanProperty(StartButton, “Enabled”) = false. The call will block the thread until the button is updated. Note that the BooleanProperty method is both a setter as a getter.

Interactive scripting with XojoScript and BasicScript in a Desktop application requires them to run in a thread that needs to be suspended once user input is required. Threadsafe is your friend.

Make sure you have the Lexing plugin installed when you use the sample projects. Note that this plugin is not dependent on the Lexing plugin.

Documentation: In the Xojo IDE (provided the plugin is installed in the Plugins Folder) navigate to the Help menu > Plugin References > Scripts.

Scripts Plugin