Community
    • Login

    How to set "Find" Background colour?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    32 Posts 7 Posters 9.2k 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.
    • Ronald FischerR
      Ronald Fischer
      last edited by

      In some themes (for example in my case “Plastic Code Wrap”), when I use “Find” to find some word, the found word is nearly impossible to spot. The default background of the theme is black, and the background of the found expression is very dark grey, nearly black, and since the foreground is not changed, I don’t see what has been found.

      I looked at the Global Styles in Styles Manager, and from the names, I had thought tthat “Find Mark Style” should be the correct one, but this is not the case, because it is set to “Red on Yellow” and certainly not used when finding the occurance of a word. For the same reason, “Smart Highlighting” can’t be the correct style, because this is also set to a colourful background. Actually, not a single one of my global styles is set to “nearly black” or “black”, so I wonder where Notepad++ gets this information from.

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Ronald Fischer
        last edited by

        @Ronald-Fischer

        When Find Next produces matches, it just shows them as “selected text” like you might do with the mouse or keyboard yourself. So look for Selected text colour in the Style Configurator…

        Ronald FischerR 1 Reply Last reply Reply Quote 1
        • PeterJonesP
          PeterJones
          last edited by PeterJones

          DELETED. Factually wrong (and way too long)

          1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn
            last edited by

            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?? :

            Imgur

            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 KilbornA 1 Reply Last reply Reply Quote 2
            • Alan KilbornA
              Alan Kilborn @Alan Kilborn
              last edited by

              @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.

              1 Reply Last reply Reply Quote 1
              • PeterJonesP
                PeterJones
                last edited by PeterJones

                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
                
                1 Reply Last reply Reply Quote 1
                • PeterJonesP
                  PeterJones
                  last edited by

                  @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

                  1 Reply Last reply Reply Quote 0
                  • guy038G
                    guy038
                    last edited by guy038

                    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 !

                    BR

                    guy038

                    1 Reply Last reply Reply Quote 1
                    • PeterJonesP
                      PeterJones
                      last edited by

                      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.

                      Alan KilbornA 1 Reply Last reply Reply Quote 0
                      • Alan KilbornA
                        Alan Kilborn @PeterJones
                        last edited by Alan Kilborn

                        @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.

                        1 Reply Last reply Reply Quote 1
                        • PeterJonesP
                          PeterJones
                          last edited by

                          @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.

                          1 Reply Last reply Reply Quote 2
                          • guy038G
                            guy038
                            last edited by guy038

                            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 :-))

                            Cheers,

                            guy038

                            P.S. :

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

                            https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5830

                            Alan KilbornA 2 Replies Last reply Reply Quote 1
                            • Alan KilbornA
                              Alan Kilborn @guy038
                              last edited by

                              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…?

                              1 Reply Last reply Reply Quote 1
                              • PeterJonesP
                                PeterJones
                                last edited by

                                @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:
                                Imgur

                                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.

                                1 Reply Last reply Reply Quote 0
                                • Alan KilbornA
                                  Alan Kilborn
                                  last edited by Alan Kilborn

                                  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?

                                  Imgur

                                  Imgur

                                  1 Reply Last reply Reply Quote 1
                                  • PeterJonesP
                                    PeterJones
                                    last edited by PeterJones

                                    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.)

                                    Alan KilbornA 1 Reply Last reply Reply Quote 2
                                    • Alan KilbornA
                                      Alan Kilborn @PeterJones
                                      last edited by Alan Kilborn

                                      @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?

                                      1 Reply Last reply Reply Quote 1
                                      • PeterJonesP
                                        PeterJones
                                        last edited by

                                        @Alan-Kilborn said:

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

                                        Taking a screenshot and using the mspaint.exe eyedropper

                                        1 Reply Last reply Reply Quote 1
                                        • PeterJonesP
                                          PeterJones
                                          last edited by

                                          @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.

                                          Alan KilbornA 1 Reply Last reply Reply Quote 1
                                          • Alan KilbornA
                                            Alan Kilborn @PeterJones
                                            last edited by

                                            @PeterJones

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

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