Community
    • Login

    How to change the style via plugin

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    3 Posts 3 Posters 3.7k 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.
    • Brad RobertsonB
      Brad Robertson
      last edited by

      Is there a way to change the current style / theme from a plugin?

      I created two different themes for my plugin to use, Development.xml and Production.xml. I want it to be very obvious to developers when they’re looking at code in the production environment.

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Brad Robertson
        last edited by

        Hello @Brad-Robertson,

        afaik there is no direct way, meaning there is no exposed function, to do it.
        What could be done is a bit of a hack. Either use something like autoit (btw. never tried it myself)
        to automate the task or write the automated task code yourself by

        • getting the menu handle
        • executing style configurator
        • using findwindow to get the newly created style configurator window
        • get combobox handle
        • selecting your theme
        • “press” save and close button.

        As said, bit of a hack.
        Maybe someone else has another or better idea how to solve this.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • dailD
          dail
          last edited by

          You could also try to manually control the style for a specific language as well. You would have to catch certain events such as NPPN_BUFFERACTIVATED and NPPN_LANGCHANGED . Any time a certain file was shown, you would manually call Scintilla messages such as SCI_STYLESETFORE etc for all the styles your plugin uses. It is not the “recommended” way but may be what you need. Note that you won’t be able to modify this style through the style configurator.

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