Question

I've been messing around with Scintilla.NET for an hour or two, but I've ran into a problem that seems like it should be easy to solve. I can't seem to find a way to change the actual highlight color of keywords in Scintilla.NET. Their documentation as far as I've seen is extremely lacking and I've found no help there. I've also seen many questions on here that haven't helped me either. It seems no matter what I do, the highlight of keywords is always darkish blue, which is extremely hard to read on my form's theme.

So far I've put together this XML style and am using the C# code to load the style. I put together the XML from several examples and the C# code is from a question on their website.

<?xml version="1.0" encoding="utf-8"?>
<ScintillaNET>

    <Language Name="65c816 asm">
        <Indentation TabWidth="4"/>
        <Lexer LineCommentPrefix=";" >
            <Keywords List="0" Inherit="False">
            adc adc and asl bcc bcs beq bit bmi bne bpl
            bra brk brl bvc bvs clc cld cli clv cmp cop
            cpx cpy dec dex dey eor inc inx iny jmp jsr
            lda ldx ldy lsr mvn mvp nop ora pea pei per
            pha phb phd phk php phx phy pla plb pld plp
            plx ply rep rol ror rti rtl rts sbc sec sed
            sei sep sta stp stx sty stz tax tay tcd tcs
            tdc trb tsb tsc tsx txa txs txy tya tyx wai
            wdm xba xce
            </Keywords>
        </Lexer>
        <Style Name="CHARACTER" ForeColor="#00AAFF"/>
        <Style Name="NUMBER" ForeColor="#00AA00"/>
    </Language>
</ScintillaNET>

And the C# code is as follows:

scintilla1.Lexing.LexerLanguageMap["65c816 asm"] = "cpp";
scintilla1.ConfigurationManager.CustomLocation = System.IO.Path.GetFullPath("65c816.xml");
scintilla1.ConfigurationManager.Language = "65c816 asm";
scintilla1.ConfigurationManager.Configure();
Was it helpful?

Solution

It seems the mistake I made was not wrapping my <Style>'s inside a <Styles> tag. After doing that it seems to work. Kind of an embarrassing thing to find out directly after posting the question.

Working now:

<?xml version="1.0" encoding="utf-8"?>
<ScintillaNET>

    <Language Name="65c816 asm">
        <Indentation TabWidth="4"/>
        <Lexer LineCommentPrefix=";" >
            <Keywords List="0" Inherit="False">
            adc adc and asl bcc bcs beq bit bmi bne bpl
            bra brk brl bvc bvs clc cld cli clv cmp cop
            cpx cpy dec dex dey eor inc inx iny jmp jsr
            lda ldx ldy lsr mvn mvp nop ora pea pei per
            pha phb phd phk php phx phy pla plb pld plp
            plx ply rep rol ror rti rtl rts sbc sec sed
            sei sep sta stp stx sty stz tax tay tcd tcs
            tdc trb tsb tsc tsx txa txs txy tya tyx wai
            wdm xba xce
            </Keywords>
        </Lexer>
        <Styles>
            <Style Name="CHARACTER" ForeColor="#00AAFF"/>
            <Style Name="NUMBER" ForeColor="#00AA00"/>
        </Styles>
    </Language>
</ScintillaNET>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top