Jump to content

Context Highlighters Update?


Recommended Posts

Thanks, downloaded. It will take a while to get used to the new colours!


Two things:


1. Straightaway I notice that <CHARNAME> with a ? directly after it does not turn red...unless there is a space between the token and the ?.


2. I don't really understand the function of strings/no strings other than the no strings seems to turn the string red/brownish. Why not no strings all the time so you can see when something isn't terminated correctly? The only two reason I can think of are a) this function is labour intensive in Context and b) the red/brownish text is not easy on the eye.


If I wanted to use no strings exclusively but want to change the colour of the string (say back to standard black) does anyone know what I can change in the highlighter?

Link to comment

The reason for the string/nostring highlight is to see if tokens, et al in your strings are spelled correctly (highlighter) - I will poke around a bit and see how to chane the colors for default string behavior. You should be able to change any of those colors to anything - will post here this afternoon how (you are talking about ConTEXT, right?)


Newest versins are in the Highlighter package here at G3 :(

Link to comment

You can change the colours pretty easily with the PSPad highlighters too. I haven't updated these for a while, but I've had more luck with PSPad than ConText or Crimson (it's free, does easy diffs, doesn't hang, handles more international characters, etc.). These aren't in the G3 pack for some reason (I thought they were) but you can download them from the link in my signature.



Link to comment



General "Do It YourSelf" Notes.


First off, while I like ConTEXT, I have moved to using Crimson Editor and TextPad as they are able to handle tons of big files highlighted without slowdown, but many folks still love ConTEXT, so here are the user notes for changing them around (the others allow much higher degrees of customization of color/behavior on the fly).


Browse to C:\Program Files\ConTEXT\Highlighters


In there are the distributed versions,








To make things easy, let's look at WeiDU_TP2string.chl


To skip right to color assignments, search for "// colors", and you should jump down to line 4476. There, you will see the following block designating the colors to be used for each Keyword category and identifier:


// colors
// note:				first value is foreground, second is background color
//						and third (optional) represents font attribute:
//						B - bold
//						I - italic
//						U - underline
//						S - strike out
//						attributes can be combined: eg. B or BI
//					  as value, it could be used any standard windows color:
//						clBlack, clMaroon, clGreen, clOlive, clNavy,
//						clPurple, clTeal, clGray, clSilver, clRed, clLime,
//						clYellow, clBlue, clFuchsia, clAqua, clLtGray,
//						clDkGray, clWhite, clScrollBar, clBackground,
//						clActiveCaption, clInactiveCaption, clMenu, clWindow,
//						clWindowFrame, clMenuText, clWindowText, clCaptionText,
//						clActiveBorder, clInactiveBorder, clAppWorkSpace,
//						clHighlight, clHighlightText, clBtnFace, clBtnShadow,
//						clGrayText, clBtnText, clInactiveCaptionText,
//						clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText,
//						clInfoBk
//					  as value, it could be used hex numeric constant too:
//						$BBGGRR - BB: blue, GG: green, RR: red, eg: $FF6A00

SpaceCol:			   clWindowText clWindow
Keyword1Col:			clNavy clWindow B
Keyword2Col:			clGreen clWindow B
Keyword3Col:			clBlue clWindow B
Keyword4Col:			clTeal clWindow B
Keyword5Col:			clPurple clWindow B
IdentifierCol:		  clWindowText clWindow
CommentCol:			 clGray clWindow
NumberCol:			  clRed clWindow
StringCol:			  clMaroon clWindow
SymbolCol:			  clGray clWindow
PreprocessorCol:		clBlue clWindow
SelectionCol:		   clWhite clNavy
CurrentLineCol:		 clBlack clYellow



You can manually set each value here, save the file, and retart ConTEXT with the new scheme. For example, if I wanted all Keywords in category 1 to be red, bold, and italic, I would change


Keyword5Col: clPurple clWindow B




Keyword5Col: clRed clWindow BI


and there I go. The string behavior is the same - change


StringCol: clMaroon clWindow


StringCol: cl<<MyPreferredColor>> clWindow


Other things you can change include moving keywords from group to group if you feel they better reflect usage or make more sense (I am always looking for a better way of making these cconsistent, like the BAF one where all Triggers are in red, and all actions are in green, so that scanning the .baf and seeing a Global where you mean SetGlobal pops right out).


For setting string delimiters, look at line 4450, and you can set them differently. But the problem with the <CHARNAME>? is I have not been able to distinguish this as ? has to be identified as an "identifier character", line 50 {IdentifierChars: a..z A..Z _ 0..9 ?} and I have not solved that problem in ConTEXT.



Reasons to try the others: ConTEXT is limited to 5 Keyword groups and you have to write out the colors in the files to get them to work. The others allow 7 to 9 keyword groups, work with many more files and huge files all open at the same time and all fully highlighted, and allow you to set all this stuff about colors, etc. inside of the program itself instead of hardcoding them.


Reasons to stick with ConTEXT: COLUMN MODE!!!!! Plus easy and familiar, drag n' drop highlighter install/rebuild, and low profile.


(p.s. If you do figure out how to allow the space to be missing and still display correcly, please let me know, so i can learn :( ).

Link to comment

Hey, Miloch, let's combine up and put them in there, too; I'd be darned proud to partner up on this stuff with you. We could put together a pretty decent package, with cool docs and everything, and toss on some more highlighters while we are at it.


So far we would have








We could ask around and see what other folks are using and throw those on too. The Keyword defs are drag n' drop once one highlighter is updated to the latest WeiDU commands - the hard part then is just figuring out how to reasonably take advantage of the number of keyword groups allowed, and how to trick the parser into the correct behavior. Since many of them come with PERL or OCAML syntax posibilities, I have had good luck just hacking those to poeces and making them look for the right stuff.

Link to comment
Hey, Miloch, let's combine up and put them in there, too
Fine with me. If you have more recent updates than what's in the package, send them to me or put them up on your site and I'll make sure the highlighters match up (unless you want to do it... the PSPad filters are just simple .ini files, so they're easy to update).
Link to comment

Miloch, I will take a lok this weekend and send you some stuff, then we can set it up all nice and send it over to CamDawg. I just want to check against 201+ commands to make sure I have any new ones, then send you the list to check against.


berelinde, in Crimson, there are a couple of different things you can do. To just change colors, italics, etc., etc., go to


View >> Set Colors


and look at the menus. They tab both as a directory tree on the left and as a 3 tab page file on the right -


under the left hand "General >> Colors" and the right hand "Keywords" you can change all 9 keyword category colors. To change the bolding/italics or the string color/begavior, the menu is


"General >> Colors" left, "General Colors" right. There you can change the background color, tetx, delimiter, string, constant, and comment colors. On the Misc. tab, you can change highlight and shadow colors, margin, etc.


All of these can be saved as your custom color pallet, and reloaded any time you want at the bottom of that screen.


as a side note, left side "General >> Visual" handles what gets bolded, italicised, you name it.


To change what category the specific command is in (say you think it is better to put all DVs in the same keyword category/color as Player1, Player2, et al), then you have to open

C:\Program Files\Crimson Editor\spec\WeiDU_TP2.key (or whatever .key file you are working with: _DTRA or _BAF. Crimson handles the keywords in one file, the string/nostring behavior and definitions in another file).


There, you can move the keywords around freely. The syntax is wicked easy:


top of file,

# EDITED BY S Vowles aka cmorgan September 16, 2007
# use with WeiDU_TP2.spc, WeiDU_TP2string.spc WeiDU_TPA.spc, WeiDU_TPAstring.spc, WeiDU_TPP.spc, WeiDU_TPPstring.spc

# === WeiDU General ===

where # is the comment and the list is the word :(

Link to comment

It occured to me, when reading jastey's Bg1 Commoners thread, that a highlighter that only had the BG1/TotSC commands in it might be useful for those wishing to mod vanilla BG1/TotSC.


Any commands used in error relating to BG2 would not highlight and thus flag to the modder a problem.


Or perhaps assigning all the BG2 commands (keywords?) to a separate list so that they could be highlighted in different colour?


Just thinking...

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...