Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change background color of function tool-tip in notepad++

I have already gone through following but that's not the issue here.

How to change background color in the Notepad++ text editor?

I am programming in python using notepad++ and applied Deep Black theme in which have a black background and white text color.

While typing a function it shows function syntax in a tool-tip having white background which contrasts with black background of notepad.

GIF explaining flickering effect.

I have already searched in Style Configurator but no luck.

How can I change tool-tip's background color ?

like image 959
Rahul Avatar asked Oct 17 '22 05:10

Rahul


1 Answers

Notepad++ uses Scintilla as its editor component. The calltip feature comes directly from scintilla. For scintilla features having no direct configuration options in the gui of Notepad++ (calltip style seems to be such a feature), you need a method to send messages to Scintilla.

One way to do that (and the only one I know of other than programming a plugin) is the use of NppExec plugin. It provides a SCI_SENDMSG command. The scintilla website provides detailed documentation about every possible message. For your use case it says this:

Call tips are small windows displaying the arguments to a function and are displayed after the user has typed the name of the function. They normally display characters using the font facename, size and character set defined by STYLE_DEFAULT. You can choose to use STYLE_CALLTIP to define the facename, size, foreground and background colours and character set with SCI_CALLTIPUSESTYLE. This also enables support for Tab characters. There is some interaction between call tips and autocompletion lists in that showing a call tip cancels any active autocompletion list, and vice versa.

Thus we need to send the SCI_CALLTIPUSESTYLE message and (continue reading on the website) we can configure foreground and background color with SCI_CALLTIPSETBACK and SCI_CALLTIPSETFORE.

So to set the color of the calltip by sending messages to the Scintilla editor component using NppExec, you need do this:

  1. install NppExec with the PluginManager or from PluginCentral. The NppExec zip file contains the dll and some subdirectories. When installing/upgrading into Notepad++ plugin directory, take care that the subdirectories NppExec is created under the plugins directory (just unzip the file into the plugins directory). The NppExec directory contains the file Scintilla.hwhich has all the definitions for the possible messages.

  2. store these lines as a NppExec script (Plugins -> NppExec -> Execute... , enter the following lines and select save, e.g. as SetCallTipStlye):

    // use CALLTIPSTYLE instead DEFAULT
    SCI_SENDMSG SCI_CALLTIPUSESTYLE 0
    // background to black ( 0 )
    SCI_SENDMSG SCI_CALLTIPSETBACK 0
    // foreground to white ( 0xffffff )
    SCI_SENDMSG SCI_CALLTIPSETFORE 0xffffff
    
  3. execute the script with OK

Now your calltip Window should be white on black, you might want to adopt the colors by changing the arguments.

If everything works as you expect, then Plugins -> NppExec -> Advanced Options offers the option Execute this script when Notepad++ starts on the upper right area of the config dialog. Select the script name under which you saved the line (e.g. SetCallTipStlye)

Alas, I have not been able to find out how to configure the autocompletion style. I hoped it would use the same style as the calltip style, but autocompletion stays black on white.

like image 72
Lars Fischer Avatar answered Oct 27 '22 07:10

Lars Fischer