inline console colouring

  • Jamie Sharpe

    Jamie Sharpe - 2013-03-08

    Is there a way to change the colour of the console using an inline method. Suppose if my script is complex, and I wanted to colour code a line when a section is getting run. I'm aware of the highlighting filters, but feel these are too high of scope/global so to speak. Is there not a way to change the colour on a local script level?

    Take for instance the following pseudo code:

        echo "Saving file..."
        echo "Setup variables..."
        SET interpreter = "C:\Lua\5.1\lua.exe"
        echo "Executing file..."
        $(interpreter) $(FULL_CURRENT_PATH)
        UNSET interpreter

    In the above script NPP_CONSOLE_FGCOLOUR sets the foreground colour for all outputted text after it, and NPP_CONSOLE_DEFCOLOURS resets the coolours to their default/user defined values, or this could be an implicit call after every script execution.

    Would something like this be possible?

  • DV

    DV - 2013-03-10

    Currently it's not possible. 
    Frankly, this question raised a fight with laziness inside of me :) And I can't guarantee the result. Here are my thought regarding the design: 
    - to have a shorter command, probably it should be used as "CON_COLOUR FG=RRGGBB BG=RRGGBB" where both "FG" and "BG" are optional parameters; 
    - to have ability to save/restore colours, one option from "CON_COLOUR PUSH/POP" or "CON_COLOUR RESET" could be used. In case of "PUSH/POP" we introduce a stack of used colours; in case of "RESET" this command will restore the colours defined in the options; 
    - finally, "CON_COLOUR" will affect just run-time colours, it should not modify NppExec's options that are saved to "NppExec.ini". 
    Now several words about implementation and why I'm lazy to do this: 
    - personally I do not need this feature and, even if it will be implemented, I most likely will not use it; 
    - the implementation requires time and I definitely would like someone to assist. 

  • DV

    DV - 2013-03-23

    However, this will be present in next version of NppExec. 
    The syntax will be "CON_COLOUR fg=RRGGBB bg=RRGGBB". And "CON_COLOUR fg=0 bg=0" to return to original values.
    Just for information, the implementation of this feature plus internal help for this command took about 8 hours in total. I.e. the equivalent of a full working day.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks