Foreground options for Selected text?
-
Hello jbrosecity,
Ahhhhh! Of course, I forgot to tell you to hit the enter key, to valid the command. You know, it’s sometimes difficult to appreciate if we provide sufficient information, or NOT, while writing a post !
Secondly, you surely didn’t notice it, but I said, in my previous post :
Remember that, with NppExec, you can write scripts and, also, run scripts on N++ start and/or N++ exit !
So, here’s, below, the method to, automatically, set the white colour to selected text, while opening Notepad++ :
-
Select the menu option Plugins - NppExec - Execute…, or type on the F6 key
-
Type the two lines, below, in the dialog :
NPP_CONSOLE ?
SCI_SENDMSG 2067 1 16777215
-
Save this script, with the name, let say, White_Selected
-
Select the menu option Plugins - NppExec - Advanced Options…
-
On the top right corner of this new dialog, choose your White_Selected script, under the mention Execute this script when Notepad++ starts:
-
Valid this change of the dialog, with the bottom OK button
-
Close and re-start N++
Et voilà ! From now on, any selected text should be displayed with foreground white colour, even if the language of the current document has its own highlighting rules !
Note : the NPP_CONSOLE ? command keeps the present state of the NppExec console. If it’s already opened, it will stay open, after running the script. If it’s was closed, it will remains closed
Enjoy Notepad++ !!
Best Regards,
guy038
P.S :
I’ve just noticed that you already got a solution, with the Python script plugin and Claudia’s help. So, now, you have two possible solutions ! Isn’t nice ?
-
-
Hiya Guy! Thanks for the alternate solution with the NppExec console. I saved Claudia’s python instructions to my programs notes file. I’ll add yours just because you took the time to type it up for me. And yes it IS fun to have multiple options. It is what I have always loved about computer software. If you can imagine it, you can do it! (Most of the time). While not a programmer at all, myself, I have run my own software business for nigh on 20 years now. Rose City Software. I am more of designer and marketer and have had the distinct pleasure of working with some great programmers over the years using C++, Delphi, and other languages… but they write the code, I just come up with and collect customer feedback for features and UI enhancements and then manage the sales and upgrades. It has been a fun and rewarding business the last couple decades and though semi retired now and traveling in my motorhome, I keep involved from my recliner with my laptop and a 4G Verizon connection. It keeps my mind active as I am just beginning my 8th decade. The rest of the time I just like to go sailing on my Catalina sailboat TheAnneMarie-dot-com :-) Thanks again Guy and Claudia… this has been a real pleasure!
-
I just checked back today to see if there had been anything new on this thread… and I see not. But I also see it has been the most often viewed thread in a while, so obviously there is some interest in this. I am grateful to Claudia and Guy for helping me get thru this, and with my selected text now appearing white against a dark blue background, I could not be happier with Notepad++. It was a fun challenge to set up python and jump through the hoops to get it to do this, but maybe the developers will take the clue and realize this is a major oversight, and there is plenty of interest in how to do this… and thus perhaps they will enable the option for foreground color with selected text in a future release. After all it is standard Windows behavior and virtually every other software I use, even the featureless Windows Notepad. handles selected text this way.
-
I would like to raise this old thread and ask - why so far the author not yet made this modification of the foreground colour in the Style Configurator?
-
It’s been almost THREE YEARS since this was last replied to and I don’t see any changes on that very basic missing feature that requires hacks described here.
Before I found out about the nppexec hack, not being able to define the “selected text” color was THE issue that prevented me from using Notepad++ as I am working on as many applications as I can with light text on a dark background, after suffering for far too long working on white backgrounds ever since it became fashionable when Macs and Windows came out with the erroneous belief that ‘paper white’ backgrounds are better for you, when, in fact computer white screens are NOT like paper, but rather much more like looking at a blinding flashlight. Fortunately, this is finally being realized as a second generation of computer users are demanding a remedy and now so many web sites and plugins and applications have ‘dark mode’ available.
Isn’t it high time for Notepad++ developers to make this fundamental, basic missing feature a priority? Am I correct in guessing the only reason that hasn’t been done so far, is that it would require a complete rewrite of the basic Notepad++ code?
For those using Notepad++ with dark grey background (RGB 16,16,16) with normal text as 192,192,192, using the nppexec plugin (nppexec.dll in \plugins\nppexec) and looking for a quick way to get the selected text to inverse these colors (in effect, get your selected text to be that of the background and the selected area to be that of the normal text color, as a true inverse), here’s my code:
put these in \plugins\config:
npes_saved.txt:
::Black_Selected
NPP_CONSOLE ?
SCI_SENDMSG 2067 1 1052688nppexec.ini:
[Options]
ScriptNppStart=“Black_Selected”
[Console]
Visible=0
ShowHelp=0
Encoding=17
SaveOnExecute=0
CmdHistory=1
SaveCmdHistory=1
TextColorNormal=0(6)
TextColorError=A01010
TextColorMessage=208020
BackgroundColor=00
NoInternalMsgs=0
[Restore]
LastSelectedScript=1Remember, the key part you need to customize to get the highlighted text to be that of your normal background color (when set as RGB 16,16,16) is the line:
SCI_SENDMSG 2067 1 1052688
The last number is what determines the color of the text when selected, using this formula: (65536blue value)+(256green value)+(red value) - note, it’s in the inverse order of the customary RGB order - transposing 16 for each B, G and R (my normal background color), you get 1052688 while the selection itself is set in the Stylers configuration as 192,192,192 (same as my normal text font color).
Sorry if it comes as a rude wake up after three years, but I thought it needed to be said. Hope the nppexec code helps beginners as a starting point to experiment with.
-
@JohnnyJim-J said in Foreground options for Selected text?:
It’s been almost THREE YEARS since this was last replied to and I don’t see any changes on that very basic missing feature that requires hacks described here.
…
Am I correct in guessing the only reason that hasn’t been done so far, is that it would require a complete rewrite of the basic Notepad++ code?
…
Isn’t it high time for Notepad++ developers to make this fundamental, basic missing feature a priority?As far as technical issues are concerned, I don’t know if there’s a reason it would be hard to be implemented or not. But if it does require a complete rewrite, then it’s not going to happen.
As far as practical reasons, it probably comes back to one return question: Did anyone involved in this thread ever create an official feature request? (I’ll give you a hint, posting in this forum is not an official feature request; see the FAQs for more.) If not, then that is the essential reason why. If an official request is ever made, then at that point, the developers can decide whether or not to prioritize working on it, depending on how useful they think it is.
Sorry if it comes as a rude wake up after three years
It’s not any form of wake up to the developers, because they’re basically uninvolved in the vast majority of discussions in this Community Forum, so your post likely isn’t on their radar at all.
-
@PeterJones said in Foreground options for Selected text?:
As far as technical issues are concerned, I don’t know if there’s a reason it would be hard to be implemented or not. But if it does require a complete rewrite, then it’s not going to happen.
As far as practical reasons, it probably comes back to one return question: Did anyone involved in this thread ever create an official feature request? (I’ll give you a hint, posting in this forum is not an official feature request; see the FAQs for more.) If not, then that is the essential reason why. If an official request is ever made, then at that point, the developers can decide whether or not to prioritize working on it, depending on how useful they think it is.
.
It’s not any form of wake up to the developers, because they’re basically uninvolved in the vast majority of discussions in this Community Forum, so your post likely isn’t on their radar at all.Thanks for the quick checkup 👍 Too bad the developers are not checking the forum like they do with other apps, where the developer checks in on users and gets involved directly, implementing features later on depending on demand and whether it interferes with general operations or not (ie whether it’s a bug, a feature request or whether a ‘problem’ is not in fact a ‘feature’).
-
@JohnnyJim-J said in Foreground options for Selected text?:
Too bad the developers are not checking the forum like they do with other apps
I think the developers spend their time in the official issues list.
There are at this moment 1273 open issues.
So I think they’ve got enough to do there without monitoring here as well.
In a perfect world they’d have time to do both, but… -
Of course, developers could have seen this issue in the issues list in either of these two places:
-
Interesting.
On a new machine: up till now, foreground for selected text has been available, and worked- might have been for a theme other than default, though.
Comment at the end of issue 3397 introduces 11567, great too, so long as it is enabled. :P -
I can’t tell from your comment if you are having troubles or they’ve been solved. If you’re still having troubles, post again in order to clarify what they are?
-
@Alan-Kilborn Hi Alan, just a concern over why the Selected Text Colour button for foreground in the Style Configurator (Global Styles) is disabled. For comparison, the button for background is enabled, but the font styles are disabled. If you could point me to where this is explained, appreciated.
-
@Laurie-Stearn said in Foreground options for Selected text?:
why the Selected Text Colour button for foreground in the Style Configurator (Global Styles) is disabled
It needs a special file created in order to be enabled; see this section of the user manual: https://npp-user-manual.org/docs/config-files/#:~:text=enableSelectFgColor.xml
-
@Alan-Kilborn Good one, thanks.
-
This post is deleted!