Hello, @penskeguy, @peterjones and All,
Five years ago, I wrote the post, below, to @dinkumoil, where I asked him about some hints, advices and possible improvements. May be, you’ll be interested by some parts of my post :-)
https://community.notepad-plus-plus.org/topic/18214/new-plugin-extsettings/32
At this time, the Selection text color setting did not exist ( BTW, I confirm your findings about this specific setting, whether the ExtSettings dialog is opened or not : it does trigger the text color to the chosen one, only when you click on the Close button or hit the ESC key ! )
From this post, I also extracted the part regarding the Selection Alpha setting, that I reproduced and completed which should be of some interest for you !
If we consider, in RGB mode :
The default current text foreground color (0,0,0)
The default current text background (255,255,255)
The default selection color (192,192,192)
The default current line background color (232,232,255)
Then, the alpha option allows you to change, BOTH, the color of background and foreground ( text ) of the resulting selection, according to the two general formulas :
• RESULTING Selection Background = α × SELECTION Background + ( 1 - α ) × CURRENT Background with α in range [0,1]
• RESULTING Selection Foreground = α × SELECTION Foreground + ( 1 - α ) × CURRENT Foreground with α in range [0,1]
In other words, with an α transparency, transposed in range [0-255], we get :
Resulting Bg Red = ( α × 192 + ( 255 - α ) × 255 ) / 255 for part of selection NOT in CURRENT line
¯¯¯
Resulting Bg Green = ( α × 192 + ( 255 - α ) × 255 ) / 255 for part of selection NOT in CURRENT line
¯¯¯
Resulting Bg Blue = ( α × 192 + ( 255 - α ) × 255 ) / 255 for part of selection NOT in CURRENT line
¯¯¯
Resulting Bg Red = ( α × 192 + ( 255 - α ) × 232 ) / 255 for part of selection within CURRENT line
¯¯¯¯¯¯
Resulting Bg Green = ( α × 192 + ( 255 - α ) × 232 ) / 255 for part of selection within CURRENT line
¯¯¯¯¯¯
Resulting Bg Blue = ( α × 192 + ( 255 - α ) × 255 ) / 255 for part of selection within CURRENT line
¯¯¯¯¯¯
And :
Resulting Fg Red = ( α × 192 + ( 255 - α ) × 0 ) / 255 = α × 192 / 255 WHATEVER the location of the SELECTION
¯¯¯¯¯¯¯¯
Resulting Fg Green = ( α × 192 + ( 255 - α ) × 0 ) / 255 = α × 192 / 255 WHATEVER the location of the SELECTION
¯¯¯¯¯¯¯¯
Resulting Fg Blue = ( α × 192 + ( 255 - α ) × 0 ) / 255 = α × 192 / 255 WHATEVER the location of the SELECTION
¯¯¯¯¯¯¯¯
As α value increases towards 255, the gray colors of selected text and the background converge, reducing contrast between them and, when α = 255, color of Fg = color of Bg = (192,192,192), leading to an invisible selected text !!
On the contrary, as α value decreases towards 0, the selection background becomes more and more transparent and, when α = 0, color of Fg = (0,0,0) and color of Bg = (255,255,255), except for the part within current line where color of Bg = (232,232,255)
When the α value has the median value 128 :
The RGB values of the background part of selection NOT in current line are 223,223,223 ≈ ( 128 × 192 + 127 × 255 ) / 255
The RGB values of the background part of selection WITHIN the current line are 212,212,223 ≈ ( 128 × 192 + 127 × ( 232 | 232 | 255) ) / 255
the RGB values of the foreground ( text ) of the selection are 96,96,96 ≈ 128 × 127 / 255
So, in the end, the values between 120 and 140 and, of course, 256 seem only interesting. And value 128, in the middle, is the good compromise !
In the specific case of α = 256, the transparency on BOTH foreground and background colors is desactiveted. However, we can consider that the resulting selection is a blend of a foreground and background opaque selection with an existing default black text on a default white background. Thus, using the above formulas and 256 as α value, we get :
Resulting Selection Background = ( 256 × 192 + ( 255 - 256 ) × 255 ) / 255 ≈ 191,75… => Background selection color = 192,192,192
Resulting Selection Foreground = ( 256 × 0 + ( 255 - 256 ) × 0 ) / 255 = 0 => Foreground selection color = 0,0,0
Best Regards,
guy038