How to change the style via plugin
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.
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.
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_LANGCHANGED. Any time a certain file was shown, you would manually call Scintilla messages such as
SCI_STYLESETFOREetc 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.