Community
    • Login

    How to assign arbitrary color to standart C++ or user defined functions ?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 521 Views
    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.
    • unal mkU
      unal mk
      last edited by unal mk

      Hi,
      i want append extra color option to Style Configurator for standart C++ , winapi or user defined functions that Style name is “SYSTEM FUNCS” (i using darkmode) . i added to stylers.xml, stylers.model.xml and DarkModeDefault.xml files this line :
      <WordsStyle name=“SYSTEM FUNCS” styleID=“25” fgColor=“FF00FF” bgColor=“000000” fontName=“Lucida Console” fontStyle=“0” fontSize=“14” keywordClass=“type3”></WordsStyle>

      i also added to langs.xml, langs.model.xml files this line :
      <Keywords name=“type3”>GlobalReAlloc GlobalAlloc ( … etc few function names )</Keywords>
      Now i can see “SYSTEM FUNCS” option and function names in C++ Language Styles under Style Configurator , but during editing C++ files colors of functions as new keywords dont change according my setting .
      What can i do for this ? .
      style_config.png

      PeterJonesP 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @unal mk
        last edited by PeterJones

        @unal-mk ,

        You cannot just arbitrarily add a new list of keywords in the XML and have it automatically propagate through Notepad++ into the lexer. They both have to be coded and compiled to make use of a given list.

        I haven’t had time to experiment (maybe later today or tomorrow), but I think the lexer might have one more keyword list that Notepad++ isn’t coded to use. If so, I will put in a PR to enable it in a future NPP release. If not, I will let you know.

        Update: this discussion has a script that works with the Python script plugin that should give you the extra list

        1 Reply Last reply Reply Quote 1
        • PeterJonesP
          PeterJones @unal mk
          last edited by

          @unal-mk ,

          After my experimentation, I found something even better: v8.6.5 wouldn’t allow the following, but the newly released v8.6.6 will (so new, it’s not even in auto-update yet, so you will have to download it from the links in the announcement):

          1. Download and Install v8.6.6
          2. Edit %AppData%\Notepad++\stylers.xml (or, in your case, %AppData%\Notepad++\theme\DarkModeDefault.xml)
          3. Search for name="cpp"
          4. Add one of the following, depending on your active theme:
            • For light mode (stylers.xml):
              <WordsStyle name="GLOBAL CLASS" styleID="19" fgColor="FF8080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" keywordClass="instre2" >instre2 useri2</WordsStyle>
              somewhere in the “cpp” block:
              1d897b0b-2af2-4f3e-bdcf-af589f6f0cd9-image.png
            • For themes\DarkModeDefault.xml use:
              <WordsStyle name="GLOBAL CLASS" styleID="19" fgColor="FF8080" bgColor="3F3F3F" fontName="" fontStyle="0" fontSize="" keywordClass="instre2">instre2 useri2</WordsStyle>
            • For any other theme, it will be similar, but you will probably need to edit the colors to match your theme, either now or after step 8
          5. File > Save
          6. File > Exit
          7. Run Notepad++ again
          8. You will get something like:
            cf88eb58-f0a1-4275-b5a7-2533029b9686-image.png

          If you don’t like my suggestion for DarkModeDefault, you can then change the style to match your whims (and obviously the list of user-defined keywords)

          Alan KilbornA unal mkU 2 Replies Last reply Reply Quote 3
          • Alan KilbornA
            Alan Kilborn @PeterJones
            last edited by

            @PeterJones said in How to assign arbitrary color to standart C++ or user defined functions ?:

            but the newly released v8.6.6 will (so new, it’s not even in auto-update yet

            So new, but has already even been superseded by 8.6.7. :-)

            1 Reply Last reply Reply Quote 3
            • unal mkU
              unal mk @PeterJones
              last edited by

              @PeterJones Thank you very much, it works on 8.6.7 portable :) .

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors