Character colors
-
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:
- Uppercase letters: RED
- Lowercase letters: BLACK
- 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.
-
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
-
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
Is it really every uppercase letter (like the M and C inUPPERCASE lowercase MixedCase Standalone Numbers: 1234 Text1With2Numbers3Embedded4
MixedCase
), or just whole words that are uppercase (likeUPPERCASE
)
-
@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. -
@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:
Cheers.
-
@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:
Whereas DejaVu Sans Mono differentiates better:
-
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 letterO
(oh) -
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. -
Even though it is already solved, I would like to mention that UDL can be used with a trick, using letters as operators.
-
Nice.
That works well for zero/oh, but not one/ell:
Whereas doing the operators as lowercase a-z will hjelp with one/ell but not zero/oh: