• Login
Community
  • Login

Character colors

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
10 Posts 5 Posters 3.1k 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.
  • T
    Tibor Batonyi
    last edited by May 6, 2021, 2:16 PM

    Could not find a solution for solving a problem which is not so complicated, but still important for me. I would like in all my texts use colors as:

    1. Uppercase letters: RED
    2. Lowercase letters: BLACK
    3. Numbers: Green
      Of course any other colors would do, the goal is to make different colors for these three type of signs.
      I think there should be a solution in Settings>Style Configurator, but the explanations there are to complicated for me.
      Any help would be greatly appreciated.
    A P 2 Replies Last reply May 6, 2021, 2:42 PM Reply Quote 0
    • A
      Alan Kilborn @Tibor Batonyi
      last edited by May 6, 2021, 2:42 PM

      @Tibor-Batonyi

      Maybe you could do it by defining a UDL (User Defined Language). Not sure about that, though as I’m not strong in knowing about that.

      I’d say that for sure you could do it with “EnhanceAnyLexer”.
      This is something called a script that would require you to set up and use the PythonScript plugin.

      It works by coloring per a “regular expression” specification.

      Base regular expressions for what you are interested in are:

      • \u : uppercase
      • \l : lowercase
      • \d : digit

      I’m sure the author of “EnhanceAnyLexer”, @Ekopalypse , will come along to tell you more about it.

      “EnhanceAnyLexer” is found here: https://github.com/Ekopalypse/NppPythonScripts/blob/master/npp/EnhanceAnyLexer.py

      1 Reply Last reply Reply Quote 3
      • P
        PeterJones @Tibor Batonyi
        last edited by May 6, 2021, 2:55 PM

        @Tibor-Batonyi ,

        Sorry, that is not natively possible. The syntax highlighters (“lexers”) that are built in don’t have a rule like that, and the User Defined Language (UDL) can allow you to define your own syntax for a list of keywords, but that doesn’t have the feature of just looking at the case of the letters in your text (though it could handle the numbers=green portion of your request)

        You can add extra highlighting to a lexer using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo … but I have a feeling if the Style Configurator is too complicated for you, using the PythonScript plugin to setup EnhanceAnyLexer might also be too difficult.

        If you’d like to try that, let us know, and we can try to guide you down the path… but you have to be willing to put in the effort.

        Also, before we’d start, we’d want a bit more detail:

        • is this a 1-time need, or something you will need many times in the future?
        • do you need it “on-the-fly” (so as you type, it automatically updates the coloring)? or would “on demand” be sufficient (so you do some edits, then hit a keystroke or run a menu option and the colors get updated"
        • Is this always in a file with the same extension (like .clr or .xyz)? Or is it just on some files that end in .txt but not others?
        • What about text with mixed case, or mix of numbers and letters, like below
          UPPERCASE
          lowercase
          MixedCase
          Standalone Numbers: 1234
          Text1With2Numbers3Embedded4
          
          Is it really every uppercase letter (like the M and C in MixedCase), or just whole words that are uppercase (like UPPERCASE)
        T 1 Reply Last reply May 6, 2021, 4:15 PM Reply Quote 2
        • T
          Tibor Batonyi @PeterJones
          last edited by May 6, 2021, 4:15 PM

          @PeterJones Thank you very much for attention and cooperation. Notepad++ is my favorite editor for writing very simply batch scripts and mainly to “decrypt” very old e-books in txt format but in unknown encoding. Notepad++ helps me to find encoding, convert to UTF8, and save in a readable format. (Books are in Hungarian or in Russian, so it is not so simple as with English books)
          But lately I have problems with passwords. I am in my eight X and my eyes not so good as earlier. It is very hard to make difference between lowercase L, uppercase i and number 1. The O and 0 also are sometimes is a problem.
          It is not so bad, when I can copy the password, but sometimes it is requested to enter it manually. My question was only to solve this problem. There is no reason to make to much efforts for this problem, because it can be solved in other ways.
          This time I simply make notes for this problem characters, it helps. I thought that there is a simply way in Notepad++ to do it.

          M P 3 Replies Last reply May 6, 2021, 4:25 PM Reply Quote 0
          • M
            Michael Vincent @Tibor Batonyi
            last edited by May 6, 2021, 4:25 PM

            @Tibor-Batonyi said in Character colors:

            I am in my eight X and my eyes not so good as earlier.

            Notepad++ has zoom (View => Zoom), and you can set your default font to a larger size and / or one that has better differences between the letters you mentioned:

            afd50aaf-5ca7-4ff4-9fbd-da428724b398-image.png

            Cheers.

            1 Reply Last reply Reply Quote 3
            • P
              PeterJones @Tibor Batonyi
              last edited by May 6, 2021, 4:39 PM

              @Tibor-Batonyi said in Character colors:

              It is very hard to make difference between lowercase L, uppercase i and number 1. The O and 0 also are sometimes is a problem.

              You might just choose a font. For example, Courier New is pretty bad:
              285bd321-ae60-420d-b665-208bd0d7b07a-image.png

              Whereas DejaVu Sans Mono differentiates better:
              fa7141fc-2248-4b54-8456-6c83f62ff645-image.png

              1 Reply Last reply Reply Quote 3
              • P
                PeterJones @Tibor Batonyi
                last edited by May 6, 2021, 4:57 PM

                @Tibor-Batonyi ,

                Another idea for a quick check is to just temporarily mark (Search > Mark) all the digits, which would distinguish all the 1s and 0s, so if it’s not higlighted, it would be a lowercase letter l (ell) or uppercase letter O (oh)

                c1b14c78-7342-4ed0-b7ff-191971ae975d-image.png

                1 Reply Last reply Reply Quote 2
                • T
                  Tibor Batonyi
                  last edited by Tibor Batonyi May 6, 2021, 5:16 PM May 6, 2021, 5:16 PM

                  Thank you for the good ideas. All of the recommendations are very useful for my everyday work.
                  More carefully choosing the font and the size of characters really solved my problem.
                  The idea of using the search engine is also very useful in my work.
                  I am very grateful for all of you for the prompt and effective help.

                  1 Reply Last reply Reply Quote 3
                  • E
                    Ekopalypse
                    last edited by May 6, 2021, 6:42 PM

                    Even though it is already solved, I would like to mention that UDL can be used with a trick, using letters as operators.

                    17f4aa4c-aea5-4bd8-b91b-70327d598ebf-image.png

                    P 1 Reply Last reply May 6, 2021, 6:51 PM Reply Quote 3
                    • P
                      PeterJones @Ekopalypse
                      last edited by May 6, 2021, 6:51 PM

                      @Ekopalypse ,

                      Nice.

                      That works well for zero/oh, but not one/ell:
                      dfef4c43-a968-4db4-a415-58ba325b91c2-image.png

                      Whereas doing the operators as lowercase a-z will hjelp with one/ell but not zero/oh:
                      d3f2e89e-8610-47aa-9a3c-b1975fc0d3e3-image.png

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