@Vitaly-Gelman ,
I wonder if there is a way to set a background to grey for a disabled block of C code
Use editor.styleSetBack(...) instead of editor.styleSetFore(...)
Also, where can I find a description of editor.styleSetFore() function
If you click on editor.styleSetFore() in your script inside Notepad++, and use Plugins > PythonScript > Context-Help, it will take you to the PythonScript documentation for styleSetFore, which tells you that the second argument is the color
namely the second argument (clr). What are the three integers there?
The “color” to use. Specifically, the three integers in the tuple are the red, green, and blue values. In my calculation, I had it set the “disabled/hidden preprocessor section” (aka “SCE_C_PREPROC_HIDDEN”) to the foreground color that’s halfway between the foreground and background of a normal preprocessor (which is a reasonable hidden value, whether in Light Mode or Dark Mode).
So if you want to set the background, you would have to pick red/green/blue values that make sense given your theme, and use editor.styleSetBack(self.SCE_C_PREPROC_HIDDEN, ...) where ... is either a tuple variable (like clr) or a literal tuple (like (63,63,63)).
(Please note that Scintilla, and thus Notepad++, treat the #if 0 exactly the same as the #ifdef NOTDEFINED, so there is no way to distinguish between a hardcoded #if 0 and the define-based #ifdef NOTDEFINED – so I hope you weren’t asking to be able to distinguish between the two, as you would be disappointed if you were.)
—
PS: the styleSetFore() didn’t specifically describe that a “color” was in a tuple, because near the top of the Editor Object page, there is a paragraph which says,
Colours are a tuple of (red, green, blue) where each of red, green, and blue is between 0 and 255.
… and that paragraph applies to all “color/colour” arguments throughout the documentation.