• Login
Community
  • Login

Dark mode for user defined language

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 2 Posters 3.0k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G
    Gor Abgaryan
    last edited by Mar 29, 2022, 10:09 PM

    Isn’t there a way to develop the dark mode for user-defined languages?

    P 1 Reply Last reply Mar 30, 2022, 12:00 AM Reply Quote 0
    • P
      PeterJones @Gor Abgaryan
      last edited by Mar 30, 2022, 12:00 AM

      @gor-abgaryan ,

      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.

      G 2 Replies Last reply Mar 30, 2022, 3:56 PM Reply Quote 0
      • G
        Gor Abgaryan @PeterJones
        last edited by Mar 30, 2022, 3:56 PM

        @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.

        P 1 Reply Last reply Mar 30, 2022, 4:14 PM Reply Quote 0
        • P
          PeterJones @Gor Abgaryan
          last edited by Mar 30, 2022, 4:14 PM

          @gor-abgaryan ,

          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) and 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.

          G 1 Reply Last reply Mar 30, 2022, 5:45 PM Reply Quote 2
          • G
            Gor Abgaryan @PeterJones
            last edited by Mar 30, 2022, 4:14 PM

            @peterjones
            And one more question: When I change the <Background color> of default style to Transparent, the numbers are not affected

            2022-03-30 20_13_29-_new 1 - Notepad++.png

            P 1 Reply Last reply Mar 30, 2022, 4:17 PM Reply Quote 0
            • P
              PeterJones @Gor Abgaryan
              last edited by PeterJones Mar 30, 2022, 4:17 PM Mar 30, 2022, 4:17 PM

              @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 & Number tab. If you want numbers transparent, you have to change the number style, not just the default style.

              e4a2540d-97e8-4381-8549-e894b79b49cc-image.png

              1 Reply Last reply Reply Quote 2
              • G
                Gor Abgaryan @PeterJones
                last edited by Mar 30, 2022, 5:45 PM

                @peterjones Thanks,
                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.

                1 Reply Last reply Reply Quote 0
                5 out of 7
                • First post
                  5/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors