The XojoSyntaxColorizer PHP class has been updated with some new features, keywords, and support for API 2.0. The new features can be seen in action in my Xojo Syntax Highlighter tool here on the website.

This is a quick outline of the latest changes. See the guide in the GitHub repository for more details.

Color Mode Support

The UseStyleSheet property has been deprecated in favor of ColorMode. This property takes the constants COLORS_AUTOMATIC, COLORS_LIGHT, and COLORS_DARK. COLORS_AUTOMATIC is most like the UseStyleSheet property when set to true, as it outputs the HTML with CSS classes instead of hard-coded colors. COLORS_LIGHT is most like setting UseStyleSheet to false, outputting the HTML with hard-coded light colors. So of course, COLORS_DARK outputs dark-compatible hard-coded colors.

The style sheet produced by the class now includes support for the prefers-color-scheme: dark media query, so dark-mode colors will automatically be used when the user views the code on a dark-compatible browser. Feel free to strip off that part of the style sheet.

Variable Definitions

A new property DefinitionStyle allows conversion of variable definitions into a specified format. The default is DEFINE_AS_ORIGINAL which leaves the definitions alone. DEFINE_WITH_DIM swaps Var for Dim, and DEFINE_WITH_VAR does the opposite.

Updated Keywords List

Both Var and Using have been added to the keywords list. Auto has been removed from the list, as it never should have been considered a keyword in the first place.