How to set "Find" Background colour?

  • DELETED. Factually wrong (and way too long)

  • I had thought tthat “Find Mark Style” should be the correct one, but this is not the case, because it is set to “Red …

    I believe this is what results if you do Search (menu) > Mark... and then, obviously, follow thru and mark some text. However, if I look closer at this, I’m not sure the default shades of red match?? :


    Maybe they are the same red but they just look different to me. Of course I could try changing it and seeing what that does… :)

  • @Alan-Kilborn said:

    I could try changing it and…

    I did try this and there is something going on here I don’t understand as I observed the same effect when selecting other colors – they didn’t seem to quite match. Is there some other thing influencing it because this is a “background” color?

    Note that I made sure I was trying it out on text that wasn’t otherwise styled/marked/lexed … a good example of really plain text is the Fix text in the change.log file.

  • I don’t know if this is the whole story, but:

    • Current Line Background > background is the background for the active line (whichever one FIND NEXT brought you to)
    • Mark Color > foreground is the box outline around the active
    • Fold Margin > background is the highlight colour for the other matches

    I thought in previous versions that it was the Smart Highlighting > background that got used for the highlighting colour for the other matches. Did a bug get introduced?

    (I’ve used up my time for now, making the anim… if no one else has confirmed, I’ll check out previous version on my next break…)

    Notepad++ v7.7.1   (64-bit)
    Build time : Jun 16 2019 - 21:24:47
    Path : C:\usr\local\apps\notepad++\notepad++.exe
    Admin mode : OFF
    Local Conf mode : ON
    OS : Windows 10 (64-bit)
    Plugins : ComparePlugin.dll HexEditor.dll MarkdownViewerPlusPlus.dll mimeTools.dll NppConverter.dll NppCrypt1015.dll NppCrypt1016.dll NppExec.dll NppFTP.dll PreviewHTML.dll PythonScript.dll XMLTools.dll

  • @PeterJones said:

    • Mark Color > foreground is the box outline around the active

    I meant Mark Color > background

    Yes, a bug was introduced in v7.7.1. In v7.7(.0), the Selected Text Colour > background was what drew the box around the active one, and Smart Highlighting > background is what coloured the other matches. That’s as I would expect.

    submitted issue #6100

  • Hello @Peterjones,

    I’m really sorry, Peter, as I could not draw any conclusion from your tests, regarding the colour change of some styles, in the Style Configurator

    First, from your animated gif picture, it happens that :

    • Some styles occur twice, as the Find Mark Style

    • Some styles are not part of the default styles list, as the Mark Color style !

    • Some styles seem to be missing, as the Fold Active style

    And, personally, I think that your image evokes different styles, at the same time which makes more difficult to understand your animation ! Don’t feel offended !

    To my mind, the default list of styles for the language Global Styles is :

    |  DEFAULT Styles of the "Global Styles" language  |  Modifiable Colours  |
    |  Global override                                 |   Back/Foreground    |
    |  Default style                                   |   Back/Foreground    |
    |  Indent guideline style                          |   Back/Foreground    |
    |  Brace highlight style                           |   Back/Foreground    |
    |  Bad brace colour                                |   Back/Foreground    |
    |  Current line background colour                  |     Background       |
    |  Selected text colour                            |     Background       |
    |  Caret colour                                    |     Foreground       |
    |  Edge colour                                     |     Foreground       |
    |  Line number margin                              |   Back/Foreground    |
    |  Fold                                            |   Back/Foreground    |
    |  Fold active                                     |     Foreground       |
    |  Fold margin                                     |   Back/Foreground    |
    |  White space symbol                              |     Foreground       |
    |  Smart Highlighting                              |     Background       |
    |  Find Mark Style                                 |     Background       |
    |  Mark Style 1                                    |     Background       |
    |  Mark Style 2                                    |     Background       |
    |  Mark Style 3                                    |     Background       |
    |  Mark Style 4                                    |     Background       |
    |  Mark Style 5                                    |     Background       |
    |  Incremental highlighting all                    |     Background       |
    |  Tags match highlighting                         |     Background       |
    |  Tag attribute                                   |     Background       |
    |  Active tab focused indicator                    |     Foreground       |
    |  Active tab unfocused indicator                  |     Foreground       |
    |  Active tab text                                 |     Foreground       |
    |  Inactive tabs                                   |   Back/Foreground    |
    |  URL howered                                     |     Foreground       |

    So, Peter, may be it would be interesting to redo your tests, after renaming your Stylers.xml file, in all your N++ versions, in order that, on starting N++, the Stylers.model.xml file would be copied as a neat Stylers.xml file !



  • Some styles are not part of the default styles list, as the Mark Color style !

    Apparently so. When I went to my fresh npp unzip (ie, exactly what came out of the zipfile), it didn’t have that extra style, and the styles behaved as expected. My bad. I’ll go close the issue.

  • @PeterJones

    Ok…so where did extra or non-standard stuff actually come from, for you? If I look at mine, I have exactly what @guy038 has enumerated.

  • @Alan-Kilborn said:

    so where did extra or non-standard stuff actually come from

    They magically appeared out of nowhere. They aren’t in my stylers.xml, and when i looked for those styles today (after having unloaded and reloaded notepad++ multiple times in the intervening day), those styles are not listed.

    I honestly don’t know where they came from. I am guessing they came when I was experimenting with the python for Style token not saved… I’m not sure what I did (though I had tried some pretty strange scintilla commands before you posted), but even that was almost a week ago, and I usually restart Notepad++ more often than that. So I don’t know where they came from… But they are gone now.

  • Hi, @peterjones, @alan-kilborn,

    I’m rather reassured because the multiple tests I did, with, both, N++ v7.7 and v7.7.1, did not show any anomaly ;-))

    Of course, a software is never perfect and can miss some associations or mis-uses ! But the good news is that, starting from a fresh official download of Notepad++, everything just go right :-))



    P.S. :

    Off topic : I’m, now, going to have a glance to that recent issue :

  • So I guess even after Peter’s diversionary tactic ;) , my question still remains of why the background color of text doesn’t seem to match the sample color presented in Style Configurator…?

  • @Alan-Kilborn said:

    why the background color of text doesn’t seem to match the sample color presented in Style Configurator…?

    Now that mine’s fixed, I think it match for me:

    The only discrepancy is the Smart Highlighting… but highlighting often has alpha/transparency, so that makes sense. Especially since it’s different depending on whether the background is normal white, or the active line, the highlight color changes slightly.

  • So I think I remain confused…or just dumb. If I create and then “mark” a bunch of whitespace (using the Search > Mark... function), and then call up the Style Configurator for Find Mark Style, the colors simply don’t match. Nothing else coloring-wise should be going on on the lines where the whitespace is to create some sort of “blend”; they were definitely “pure white” before marking. Clearly the colors are different in the screenshots (I used a freshly unzipped portable 7.7.1), below.

    It begs the question, if the user wants to set up a certain color, and after doing so gets something different, what’s the point?



  • I still maintain it’s transparency. If it is, there should be a reasonably-consistent mapping from what you program for Find Mark Style > Background to what you measure, compared to the background. Since we know that something that’s 100% transparent will only show the background, and nothing of what you program; and since we know that something that’s 0% transparent will only show the programmed value and nothing of what’s in the background, we can figure out that the formula is: transparency = (measured-programmed)/(background-programmed).

    So taking your example of red on white:

    background: 255 255 255     WHITE
    programmed: 255   0   0     BRIGHT RED
    measured  : 255 155 155
    => 155/255=60.8% of the way from programmed to background (ie, 60% transparent)

    Change the background to black, with the same programmed value, and I see (100,0,0) as the darker red highlight:

    background:   0   0   0     BLACK
    programmed: 255   0   0     BRIGHT RED
    measured  : 100   0   0
    => 155/255=60.8% of the way from programmed to background

    Change the background to charcoal:

    background:  63  63  63     CHARCOAL
    programmed: 255   0   0     BRIGHT RED
    measured  : 138  38  38
    R   CALC: (138-255=-117)/(63-255=-192) = 117/192 = 60.9%
    G,B CALC: (38-0=38)/(63-0) = 38/63 = 60.3%

    After three experiments getting within resolution of each other as far as measured color vs programmed and background, I am going to claim that it’s 60% transparency.

    if the user wants to set up a certain color, and after doing so gets something different, what’s the point?

    Yeah, it would be nice to have the ability to enable/disable transparency on those “highlight” styles, like Find Mark and Smart Highlighting. Maybe you should suggest it ;-). (I already made and cancelled an issue report for this thread, so I’m not going to do another.)

  • @PeterJones said:

    I still maintain it’s transparency

    And that’s fine, but I maintain that the sample shown should reflect that to show a representative sample. :)

    Maybe I will enter an issue.

    BTW, how are you “measuring” to produce your measured values above?

  • @Alan-Kilborn said:

    BTW, how are you “measuring” to produce your measured values above?

    Taking a screenshot and using the mspaint.exe eyedropper

  • @Alan-Kilborn said:

    sample shown should reflect that to show a representative sample

    How many different backgrounds should it show the sample against? Because there’s the default background, and the selected-line background, and … All of those will influence what the final result looks like. (Probably my vote would go for default background, but the results will still vary depending on circumstances.) I think if the box at least admitted which styles were used with transparency (even if it doesn’t let you choose how much transparency), then the user could be considered informed that the final result won’t match exactly what’s in the sample box.

  • @PeterJones

    Maybe we are just happy that if some sort of red (or blue, or whatever) is chosen…some sort of red (or…) results. :)

  • @Alan-Kilborn You are close! Indeed, you are right in that it takes the background from “selected text colour”, but the foreground is still taken depending on the respective syntax highlighting, which means I have to find a background colour for this, which is different from the current background colour, but at the same time sufficiently distinct from every foreground colour which might be defined by the syntax settings.

  • @Ronald-Fischer

    I supposed the true answer is that it is not a simple thing. Regarding foreground and background, even that is complicated because even though both appear for each type of setting, sometimes one or the other is ignored (see @guy038 's table above).

Log in to reply