User Tools

Site Tools


htmlcolorizer

HTMLColorizer

If your project deals with HTMLViewer showing Web pages, make it look more professional showing highlighted HTML source code with any Color Schemes you choose… in no time and on any TextArea control you choose! HTMLColorizer for Xojo highlights the HTML tags or keywords, attributes, entities, strings and comments.

Use any regular or subclassed TextArea to colorize HTML code as you write or from the Clipboard! Use as many Color Schemes as you want changing between them in a snap!

Implement this capacity in your current or new projects in seconds, using the already provided TextArea subclass of the example project as an starting point, or providing your own subclass or the regular TextArea control from the Xojo Framework Library!

HTMLColorizer in the Store

You can buy your HTMLColorizer License at the AprendeXojo Store using this link.

Compatibility

HTML Colorizer for Xojo is compatible with 32 and 64 bits deployments for Desktop, under MacOS, Windows and Linux!

What you Get?

The HTMLColorizer class, the project example and a TextArea custom subclass that you can use in your own projects or as an starting point to implement your own TextArea subclasses! Everything in non-encripted form with access to full source code!

In addition, you will receive all product updates during one year for free!

How it Works?

Main Functionality

In order to get a instance of the parser, you can use:

  • dim cHTML as HTMLColorizer = new HTMLColorizer( sourceTextAreaControl )
  • dim cHTML as HTMLColorizer = new HTMLColorizer( sourceTextAreaControl, colorScheme ) colorScheme is a Dictionary with the keys specified by the HTMLColorizer Class To colorize the current contents of the TextArea class or subclass instance, use: * cHTML.colorize In order to change the applied color scheme, use: * cHTML.Colors newColorScheme newColorScheme is a Dictionary with the keys specified by the HTMLColorizer Class

In order to reset colors to the default color scheme:

  • cHTML.resetColors

Color Scheme Dictionary

In order to define the Default Color Scheme or to change the Color Scheme to apply to the HTML source code, you need to provide the HTMLColorizer instance a Dictionary with the following keys:

  • HTMLColorizer.kGeneral. Comments and the opening and closing tag characters.
  • HTMLColorizer.kStrings. Color to apply to all the Strings in the source code.
  • HTMLColorizer.kKeywords. Color to apply to the HTML tags and keywords.
  • HTMLColorizer.kEntities. Color to apply to HTML entities.
  • HTMLColorizer.kAttributes. Color to apply to HTML tags attributes.

For example, the following code creates a new Color Scheme and passes it to a instance of the HTMLColorizer class:

dim cHTML as HTMLColorizer = new HTMLColorizer( sourceTextAreaControl )

Dim d As New Dictionary

d.Value(htmlcolorizer.kGeneral) = "&c292ff2" // Comments < and > d.Value(htmlcolorizer.kStrings) = "&cba226e" // Strings d.Value(htmlcolorizer.kKeywords) = "&c292ff2" // Keywords d.Value(htmlcolorizer.kEntities) = "&cFF0000" // Entities like the HTML &copy; d.Value(htmlcolorizer.kAttributes) = "&cab4b0d" // HTML attributes

cHTML.Colors d

If the Provided dictionary lacks one or more expected keys, then the HTMLColorizer class will raise an Exception that you can catch to deal with.

htmlcolorizer.txt · Last modified: 2019/09/06 12:07 by bloguintosh