Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Can't define php color for functions

    Help wanted · · · – – – · · ·
    2
    3
    37
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Rastislav Bury
      Rastislav Bury last edited by

      Hi

      I am trying to create my own template which I was using till now with another app, but I have trouble with php functions and reserver words like “echo” or “include”. I am trying to set the foreground and background colour for it, I can’t find how.
      E.g. I know how to set all other elements color, it’s just for these ones. Can someone help me?

      My xml config file contains regarding php:
      ```
      <LexerType name=“php” desc=“php” ext=“”>
      <WordsStyle name=“QUESTION MARK” styleID=“18” fgColor=“000000” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      <WordsStyle name=“DEFAULT” styleID=“118” fgColor=“000000” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      <WordsStyle name=“STRING” styleID=“119” fgColor=“008000” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      <WordsStyle name=“STRING VARIABLE” styleID=“126” fgColor=“808000” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      <WordsStyle name=“COMPLEX VARIABLE” styleID=“104” fgColor=“000000” bgColor=“FFFFFF” fontName=“” fontStyle=“1” fontSize=“” />
      <WordsStyle name=“SIMPLESTRING” styleID=“120” fgColor=“008000” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      <WordsStyle name=“WORD” styleID=“121” fgColor=“8959A8” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” keywordClass=“instre1” />
      <WordsStyle name=“NUMBER” styleID=“122” fgColor=“000080” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      <WordsStyle name=“VARIABLE” styleID=“123” fgColor=“0000FF” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      <WordsStyle name=“COMMENT” styleID=“124” fgColor=“808080” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      <WordsStyle name=“COMMENTLINE” styleID=“125” fgColor=“808080” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      <WordsStyle name=“OPERATOR” styleID=“127” fgColor=“000000” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“” />
      </LexerType>

      PeterJones 1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones @Rastislav Bury last edited by PeterJones

        @Rastislav-Bury ,

        In PHP, the echo and include keywords are set with the WORD color style, along with all the all the other keywords.

        If you are changing the WORD entry as shown above, and it’s not changing, make sure you are exiting Notepad++ and re-running, because it doesn’t see “live” changes in your stylers.xml or themes\MyTheme.xml – the application needs to be reloaded to see changes to those config files.

        –

        update: In case it’s not clear: the entire list of keywords in the Settings > Style Configurator > php > WORD’s Default keywords box will all get the same color. If you want a different color for just those two keywords, that’s not something that the PHP lexer can do on its own. You might use the EnhanceAnyLexer plugin to add “extra” colors for those keywords using something like 0x0000FF = \b(echo|include)\b.

        OTOH: if you want them to be the same color as other keywords, and they aren’t, then maybe it’s because you updated Notepad++ from a version that didn’t have those two keywords. If that’s the case, they will be missing from the Default keywords box mentioned above. You can edit %AppData%\Notepad++\langs.xml and change the list of default keywords in there… or, easier, you can just add them to the User-defined keywords box on the same Style Configurator page. (Though it looks like echo and include have been there for at least a decade, so that’s probably not it)

        Rastislav Bury 1 Reply Last reply Reply Quote 2
        • Rastislav Bury
          Rastislav Bury @PeterJones last edited by

          @PeterJones Thank you. Don’t know why I didn’t saw it…

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors