Dark mode for user defined language
Isn’t there a way to develop the dark mode for user-defined languages?
PeterJones last edited by
Yes. Pick dark mode colors when you define it.
You can see the “Markdown (preinstalled dark mode)” UDL that comes with Notepad++ as an example.
@peterjones Thanks for help.
But every time I change the theme from Dark>Default or Default>Dark, I have to do changes in UDL either.
PeterJones last edited by
Ah, now I understand.
You are correct, the UDL system isn’t aware of the Dark Mode state, so will not automatically update. You could have two different UDL (like the Markdown pair released with Notepad++), and just switch between them when you switch from Light to Dark and back.
The idea behind the dark mode toggle (and it being in a preference dialog, rather than in the View or similar menu, or having a keyboard shortcut) is that it’s meant as a one-and-done: you pick which you prefer, and stick with it. If you are choosing to go beyond that intention, then you are adding more work on yourself.
But if you want to simplify the extra work, you can use the second script I shared in this recent post, which toggles the active file between
Markdown (preinstalled dark mode). To set it up: install PythonScript plugin, create a new script, paste in the contents of that script from the other post, change the names of the UDLs to your two UDLs (light and dark mode versions); if you use the PythonScript configuration to put that script in the main PythonScript menu, then you can use Shortcut Mapper to assign a keyboard shortcut to the toggle. Once all that setup is done, you just have to type that keyboard shortcut to toggle the UDL every time you swap between Notepad++'s Dark and non-Dark modes.
And one more question: When I change the <Background color> of default style to Transparent, the numbers are not affected
PeterJones last edited by PeterJones
@gor-abgaryan said in Dark mode for user defined language:
default style to Transparent, the numbers are not affected
That’s because numbers have their own Styler button on the
Comment & Numbertab. If you want numbers transparent, you have to change the number style, not just the default style.
Yes, that helped, but in any case, I have 2 UDL-s loaded in the tool, and every time I change the npp theme, I need to run the keyboard shortcut in order to change the UDL. I thought the script will automatically change the UDL based on the Dark/Light mode of NPP. But in any case, your suggestions were very helpful. Thanks. I figured the PythonScript plugin out.