This is kind of necroposting, but I just wanted to share a PythonScript script I made that hopefully makes it reasonably easy to improve the contrast of the autocompletion list selected line.
# https://community.notepad-plus-plus.org/topic/20320/change-autocomplete-background-color/13 from __future__ import print_function from Npp import * def caret_line_and_selection_back(): ''' WORDSTYLESUPDATED notifications don't give anything like style names when they fire so we identify each style by a tuple of (caret line back, selection back) which is hopefully unique to that style. ''' return (editor.getElementColour(ELEMENT.CARET_LINE_BACK), editor.getElementColour(ELEMENT.SELECTION_BACK)) class ALSMCT(object): def __init__(self): self.off = False self.style_list_defaults = {} def reset_autocomp_list_colors(self): caret_selback = caret_line_and_selection_back() list_defaults = self.style_list_defaults.get(caret_selback) if list_defaults and 'back' in list_defaults and 'fore' in list_defaults: list_default_fore = list_defaults['fore'] print('resettting autocompletion list fore to style default %s' % (list_default_fore,)) editor.setElementColour(ELEMENT.LIST_SELECTED, list_defaults['fore']) list_default_back = list_defaults['back'] print('resettting autocompletion list back to style default %s' % (list_default_back,)) editor.setElementColour(ELEMENT.LIST_SELECTED_BACK, list_defaults['back']) else: # couldn't find current style, so just use global defaults print('resetting autocompletion list colors to global defaults') editor.resetElementColour(ELEMENT.LIST_SELECTED) editor.resetElementColour(ELEMENT.LIST_SELECTED_BACK) def on_wordstyles_updated(self, notif): # map current (caret line back, selection back) (which this script doesn't change) # to LIST_SELECTED and LIST_SELECTED_BACK (which it does change) # that way we can later restore the defaults for the current lexer. # Note that editor.resetElementColour just resets to global defaults # NOT the default for the current style caret_selback = caret_line_and_selection_back() list_selected_defaults = { 'fore': editor.getElementColour(ELEMENT.LIST_SELECTED), 'back': editor.getElementColour(ELEMENT.LIST_SELECTED_BACK) } self.style_list_defaults.setdefault(caret_selback, list_selected_defaults) print('default autocompletion list style is %s when caret line back is %s and selection back is %s' % (*caret_selback, list_selected_defaults)) # now change the list styles to caret line styles (if not ALSMCT_OFF) self.on_bufferactivated(notif) def on_bufferactivated(self, notif): if self.off: return caret_line_back = editor.getElementColour(ELEMENT.CARET_LINE_BACK) list_fore = editor.getElementColour(ELEMENT.LIST) # match list fore color to caret line fore color as well to avoid low contrast # (since default LIST_SELECTED may be similar to CARET_LINE_BACK) print('setting autocompletion list back color to %s' % (caret_line_back,)) editor.setElementColour(ELEMENT.LIST_SELECTED_BACK, caret_line_back) print('setting autocompletion list fore color to %s' % (list_fore,)) editor.setElementColour(ELEMENT.LIST_SELECTED, list_fore) if __name__ == '__main__': try: alsmct.off = not alsmct.off # running script multiple times toggles it if alsmct.off: alsmct.reset_autocomp_list_colors() else: alsmct.on_bufferactivated({}) except NameError: alsmct = ALSMCT() alsmct.on_wordstyles_updated(1) notepad.callback(alsmct.on_bufferactivated, [NOTIFICATION.BUFFERACTIVATED]) notepad.callback(alsmct.on_wordstyles_updated, [NOTIFICATION.WORDSTYLESUPDATED])Running the script changes the autocompletion list style as follows:
running it an odd number of times (including once) causes the text color for the selected autocompletion line to match the text color for the other autocomp lines, and causes the back color of the selected autocomp line to match the back color of the caret line in the document.5d506c34-392c-4ad8-93d9-89975828cb87-image.png running it an even number of times resets the style for the selected autocompletion line restores it to the defaults for the theme.
4f6af084-acca-46c7-a012-3ae2dbe33f1d-image.png