Latest post of the previous page:
Works perfectly. Thanks a lot!Colorer — syntax highlighting and text parsing
Colorer — syntax highlighting and text parsing
Is it possible to override specific color when you're extending the scheme? I can override any hrc and add rules, I also can re-define regions with regular expressions, but is there a simple way to replace one color with another without changing the syntax? Maybe there's a trick I don't know?
- HaRT
- Moderator
- Posts: 10806
- Joined: Tue 30 Aug, 2005 17:21
- Has thanked: 220 times
- Been thanked: 357 times
Colorer — syntax highlighting and text parsing
joric, I don't know if it's possible for an individual schema or an individual color, but colors definitely can be overridden using
.hrd
files — please have a look at files in FarColorer's common.zip/hrd/console/
and common.zip/hrd/rgb/
and see if/how they are referenced from .hrc
schemas. There's even some old documentation which I believe to be still mostly correct.Фар есть инструмент, а не нянька. © 2009 DrKnS
Colorer — syntax highlighting and text parsing
I created my own color scheme in this way:
1) Create a color definition file pepak.hrd. I don't quite remember how I did it, but probably I copied the default color scheme and started modifying it to my liking:
2) Create a scheme list file styles.xml:
Note that you should use an absolute path here because otherwise the file locations are considered relative to the catalog file, not the styles file.
3) In Plugin Options -> FarColorer -> Main Settings, add the path to the scheme list file: %FARPROFILE%\Colorer\styles.xml
1) Create a color definition file pepak.hrd. I don't quite remember how I did it, but probably I copied the default color scheme and started modifying it to my liking:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hrd PUBLIC "-//Cail Lomecb//DTD Colorer HRD take5//EN" "http://colorer.sf.net/2003/hrd.dtd">
<hrd xmlns="http://colorer.sf.net/2003/hrd">
<assign name="def:Text" fore="#b" back="#1"/>
<assign name="def:HorzCross" fore="#f" back="#0"/>
<assign name="def:VertCross" fore="#f" back="#0"/>
<assign name="def:Syntax"/>
<assign name="def:Number" fore="#b"/>
<assign name="def:NumberSuffix" fore="#b"/>
<assign name="def:String" fore="#b" back="#9"/>
<assign name="def:StringContent" fore="#f"/>
<assign name="def:StringEdge" fore="#c"/>
<assign name="def:CharacterContent" fore="#f"/>
<assign name="def:Comment" fore="#7"/>
<assign name="def:CommentContent" fore="#7"/>
<assign name="def:CommentEdge" fore="#7"/>
<assign name="def:CommentDoc" fore="#7"/>
<assign name="def:CommentDocContent" fore="#7"/>
<assign name="def:CommentDocEdge" fore="#7"/>
<assign name="def:Symbol" fore="#e"/>
<assign name="def:SymbolStrong" fore="#e"/>
<assign name="def:Prefix" fore="#b"/>
<assign name="def:Operator" fore="#b"/>
<assign name="def:Keyword" fore="#f"/>
<assign name="def:TypeKeyword" fore="#f"/>
<assign name="def:Function"/>
<assign name="def:Register"/>
<assign name="def:Constant"/>
<assign name="def:BooleanConstant"/>
<assign name="def:Var"/>
<assign name="def:VarStrong"/>
<assign name="def:Identifier"/>
<assign name="def:Directive" fore="#7"/>
<assign name="def:Parameter" fore="#7"/>
<assign name="def:Tag" fore="#b"/>
<assign name="def:OpenTag" fore="#f"/>
<assign name="def:CloseTag" fore="#f"/>
<assign name="def:Label" fore="#b"/>
<assign name="def:LabelStrong" fore="#b"/>
<assign name="def:Insertion" fore="#b"/>
<assign name="def:Error" back="#c" fore="#e"/>
<assign name="def:ErrorText" fore="#d"/>
<assign name="def:TODO" fore="#7"/>
<assign name="def:Debug" fore="#a" back="#2"/>
<assign name="def:URI" fore="#f"/>
<assign name="def:EMail" fore="#f"/>
<assign name="def:Date" fore="#b"/>
<assign name="def:Time" fore="#b"/>
<assign name="def:PairStart" fore="#d"/>
<assign name="def:PairEnd" fore="#d"/>
<assign name="def:PairStrongStart" fore="#d" back="#f"/>
<assign name="def:PairStrongEnd" fore="#d" back="#f"/>
<assign name="def:Newer" fore="#a"/>
<assign name="def:Older" fore="#b"/>
<assign name="def:Different" fore="#c"/>
<!-- <assign name="vfy:VfyOperatorMatched" fore="#c"/> -->
<assign name="vfy:VfyOperatorAdded" fore="#a"/>
<assign name="vfy:VfyOperatorChanged" fore="#c"/>
<assign name="vfy:VfyOperatorDeleted" back="#c"/>
<assign name="vfy:VfyOperatorCopied" fore="#e"/>
<assign name="vfy:VfyOperatorRenamed" fore="#e"/>
<assign name="dirsync:DirSyncUnimportantFile" fore="#3"/>
<assign name="dirsync:DirSyncImportantFile" fore="#f" back="#3"/>
<assign name="dirsync:MissingLeft" fore="#f" />
<assign name="dirsync:MissingRight" fore="#c" />
<assign name="dirsync:OlderLeft" fore="#a" />
<assign name="dirsync:OlderRight" fore="#f" />
<assign name="dirsync:FailedLeft" back="#c" fore="#e" />
<assign name="dirsync:FailedRight" back="#c" fore="#e" />
<assign name="dirsync:FailedBoth" back="#c" fore="#e" />
<assign name="dirsync:Different" fore="#a" />
</hrd>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<hrd-sets>
<hrd class="console" name="pepak" description="Pepak">
<location link="%FARPROFILE%\Colorer\pepak.hrd"/>
</hrd>
</hrd-sets>
3) In Plugin Options -> FarColorer -> Main Settings, add the path to the scheme list file: %FARPROFILE%\Colorer\styles.xml
Colorer — syntax highlighting and text parsing
I mean if you're EXTENDING language rules. You're not overriding HRC you just fix bad mapping. It's simpler to show:
auto/python-extended.hrc:
auto/python-extended.hrc:
Code: Select all
<hrc>
<prototype name="pyExt" group="other" description="Python (extended)">
<filename weight="5">/\.py$/i</filename>
</prototype>
<type name="pyExt">
<import type="python"/>
<!-- I can repaint numbers here as so -->
<regexp match="/\b\d+([Ee][-+]?\d+)?([jJ])?(\w*)\b/" region0="def:NotANumber" region1="def:NumberSuffix" region2="def:Error" />
<!-- Is it possible to remap one color (region, rather) to another color here, without copypasting the syntax rules? -->
<inherit scheme="python">
<virtual scheme="python" subst-scheme="pyExt"/>
</inherit>
<!-- I can also remap all remaining characters to symbols here -->
<regexp match='/\w/' region0="def:Symbol"/>
</type>
</hrc>
Colorer — syntax highlighting and text parsing
OK, I got it, kind of. We can use virtual schemes peeked up in "Far Colorer - Region Info" to override elements, e.g.
It doesn't always work (not all languages use separate schemas for all the entities) but it is something.
Code: Select all
<virtual scheme="c:Expression" subst-scheme="myCExpression"/>