SWAPPING OUT THEMES
-
Hello.
Notepad++ has been my go-to text editor for text (.txt) files for many years. I have used Notepad++ for coding less regularly. The default (colour) theme for plain text files are okay, but for coding languages another theme is preferred. I know where to change the global theme but find it cumbersome to jump from one theme to another.
Is it possible (as an example) to use “Bespin” theme for Python (.py) scripts but for anything else use the default theme? How does one do it?
Else workarounds that I would find helpful (and ask guidance for):
-
Install two Notepad++ versions. One for text processing with minimum add-on support and default theme. The another for codes … for the moment tuned for Python usage.
-
An add-on that can switch be linked to a shortcut key to swap between themes.
-
Customizing a theme that will become active when working with plain text (.txt or unspecified).
-
A dark theme that works for both plain text and code (for now: Python).
Thank you for your consideration.
Regards.
Dan -
-
I assume the easiest would be to use a zipped notepad++ package and install in
two different places but if I’m right you are also aware of python script plugin and
another solution would be to do something like thisdef change_styles(): # editor.styleResetDefault() editor.styleSetBack(0, (30, 30, 30)); editor.styleSetFore(0, (200, 200, 200)); editor.styleSetBack(1, (30, 30, 30)); editor.styleSetFore(1, (87, 166, 74)); editor.styleSetBack(2, (30, 30, 30)); editor.styleSetFore(2, (255, 128, 128)); editor.styleSetBack(3, (30, 30, 30)); editor.styleSetFore(3, (214, 157, 133)); editor.styleSetBack(4, (30, 30, 30)); editor.styleSetFore(4, (214, 157, 133)); editor.styleSetBack(5, (30, 30, 30)); editor.styleSetFore(5, (54, 125, 198)); editor.styleSetBack(6, (30, 30, 30)); editor.styleSetFore(6, (200, 200, 200)); editor.styleSetBack(7, (30, 30, 30)); editor.styleSetFore(7, (200, 200, 200)); editor.styleSetBack(8, (30, 30, 30)); editor.styleSetFore(8, (138, 138, 255)); editor.styleSetBack(9, (30, 30, 30)); editor.styleSetFore(9, (250, 205, 34)); editor.styleSetBack(10,(30, 30, 30)); editor.styleSetFore(10, (255, 128, 0)); editor.styleSetBack(11,(30, 30, 30)); editor.styleSetFore(11, (141, 166, 206)); editor.styleSetBack(12,(30, 30, 30)); editor.styleSetFore(12, (87, 166, 74)); editor.styleSetBack(13,(30, 30, 30)); editor.styleSetFore(13, (214, 157, 133)); editor.styleSetBack(14,(30, 30, 30)); editor.styleSetFore(14, (0, 97, 194)); editor.styleSetBack(15,(30, 30, 30)); editor.styleSetFore(15, (200, 200, 200)); editor.styleSetBack(16,(30, 30, 30)); editor.styleSetFore(16, (200, 200, 200)); editor.styleSetBack(17,(30, 30, 30)); editor.styleSetFore(17, (200, 200, 200)); editor.styleSetBack(18,(30, 30, 30)); editor.styleSetFore(18, (200, 200, 200)); editor.styleSetBack(19,(30, 30, 30)); editor.styleSetFore(19, (200, 200, 200)); editor.styleSetBack(20,(30, 30, 30)); editor.styleSetFore(20, (200, 200, 200)); editor.styleSetBack(21,(30, 30, 30)); editor.styleSetFore(21, (200, 200, 200)); editor.styleSetBack(22,(30, 30, 30)); editor.styleSetFore(22, (200, 200, 200)); editor.styleSetBack(23,(30, 30, 30)); editor.styleSetFore(23, (200, 200, 200)); editor.styleSetBack(24,(30, 30, 30)); editor.styleSetFore(24, (200, 200, 200)); editor.styleSetBack(25,(30, 30, 30)); editor.styleSetFore(25, (200, 200, 200)); editor.styleSetBack(26,(30, 30, 30)); editor.styleSetFore(26, (200, 200, 200)); editor.styleSetBack(27,(30, 30, 30)); editor.styleSetFore(27, (200, 200, 200)); editor.styleSetBack(28,(30, 30, 30)); editor.styleSetFore(28, (200, 200, 200)); editor.styleSetBack(29,(30, 30, 30)); editor.styleSetFore(29, (200, 200, 200)); editor.styleSetBack(30,(30, 30, 30)); editor.styleSetFore(30, (200, 200, 200)); editor.styleSetBack(31,(30, 30, 30)); editor.styleSetFore(31, (200, 200, 200)); editor.styleSetBack(32,(30, 30, 30)); editor.styleSetFore(32, (200, 200, 200)); editor.styleSetBack(33,(30, 30, 30)); editor.styleSetFore(33, (43, 145, 175)); editor.styleSetBack(34,(38, 79, 120)); editor.styleSetFore(34, (220, 220, 220)); editor.styleSetBack(35,(30, 30, 30)); editor.styleSetFore(35, (147, 0, 0)); editor.styleSetBack(36,(30, 30, 30)); editor.styleSetFore(36, (200, 200, 200)); editor.styleSetBack(37,(30, 30, 30)); editor.styleSetFore(37, (136, 138, 133)); editor.styleSetBack(38,(0, 0, 0)); editor.styleSetFore(38, (128, 128, 128)); editor.setCaretFore((128, 128, 128)) editor.setCaretLineBack((0, 0, 0)) for i in range(15): editor.styleSetFont(i, 'Courier New') editor.styleSetSize(i,12) editor.setFoldMarginColour(True, (30, 30, 30)) editor.setFoldMarginHiColour(True, (30, 30, 30)) def callback_BUFFERACTIVATED(args): if editor.getLexer() in [1,2]: change_styles() else: editor.setFoldMarginColour(False, (30, 30, 30)) editor.setFoldMarginHiColour(False, (30, 30, 30)) notepad.clearCallbacks([NOTIFICATION.BUFFERACTIVATED]) notepad.callback(callback_BUFFERACTIVATED, [NOTIFICATION.BUFFERACTIVATED])
Put this into the user startup.py.
Basically, every time you switch/open a document it checks if it is either a normal text
or python document and in such a case changes the styles.
The meaning of the styles can be seen in stylers.xml but be aware that not
every style id from global styles can be set but needs to be callled with a different
function like setFoldMarginColour etc…Cheers
Claudia