[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [StrongED] background colour for certain parts -- another Modefile Q

In message <3b8b26d956.jim@xxxxxxxxxxxxxxxx>
          Jim Nagel <stred@xxxxxxxxxxxxxxxx> wrote:

> I'd like to add a way of highlighting bits of PHP within an HTML page 
> to make them easier to see.  In particular:
> (1) Any section beginning "<?php " and ending " ?>" should have a 
> light background colour, say RGB #dfdeff.  A light background colour 
> so that any foreground colour used for other purposes is still clear.

If that section is a single line then you can use the SyntaxWords
groups. For areas of more than one textline you have to use one of the
SyntaxComment groups.

> (2) Harder; could wait till later:  Within such a PHP section, a 
> slightly darker background would be nice for any "if" clause.  Such 
> clauses in PHP begin with " if " though possibly that opening space 
> could be a tab or newline etc.  I'm only a beginner and not sure yet 
> how PHP ends such a clause.

StrongED does not support layering of syntax colours. If you want "if"
to be coloured differently then I'd suggest just colouring the first and
last lines of a PHP section with a special background colour (probably
to end-of-line). The "if" can then be coloured on its own. The PHP mode
already does something like this.

>     Further, the PHP I'm dealing with (written for me by my son as a 
> template for my project) has some *nested* if-clauses -- it'd be nice 
> to display them with background colour progressively a bit darker.

As above, not supported. The usual way of making nesting visible is to
use indentation. The deeper the nesting the larger the indentation.
> I had a look at other StrongEd modes and found that background colour 
> is used in a similar way in Keith Hopper's XHTML mode (2011-12-22).  
> He uses a cream background for anything between quotemarks, but I 
> can't work out from poring over his Modefile how he does it.

The colours are set in the Mode Choices -> Colours. Select 'Strings' in
the Elements menu then set foreground and background colours.
> Also tried the StrongEd help for Syntax Options but no eureka moment.

SyntaxOptions has no bearing on the colours used but it does control
whether text inside (double-) quotes is considered a string.

> Stray question:  In the ColoursAlt and ColoursStd files for any mode, 
> why eight digits, whereas RGB colour codes are normally six?  Is there 
> any explanation in the StrongHelp?  Example:
>      Foreground_Group7:85008BFF
>      Background_Group7:00000000
>      BitmapStyle_Group7:Regular
>      ColourFlags_Group7:FFFEFFFF

The colours are described as ColourTrans palette entries, BBGGRRxx. The
bottom byte xx is undefined and may be used as an application sees fit.

In the case of StrongED the bottom byte is set to &FF if the colour is
in palette entry format. The reason is historical; older versions also
allowed the colour to be a wimp colour (0 - 15) in the bottom 4 bits.

For StrongED 4.69 I removed all code to support wimp colours internally,
made everything use palette entries. Wimp colours still present in old
choices files get converted to palette entries when the file is read.

This change proved beneficial on systems where colours are in different
format to RGB. StrongED worked on them without (further) changes, it
simply passed the palette entries through ColourTrans before using them.


StrongED Developer

To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at