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.
    • Gor AbgaryanG
      Gor Abgaryan
      last edited by

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

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Gor Abgaryan
        last edited by

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

        Gor AbgaryanG 2 Replies Last reply Reply Quote 0
        • Gor AbgaryanG
          Gor Abgaryan @PeterJones
          last edited by

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

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Gor Abgaryan
            last edited by

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

            Gor AbgaryanG 1 Reply Last reply Reply Quote 2
            • Gor AbgaryanG
              Gor Abgaryan @PeterJones
              last edited by

              @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

              PeterJonesP 1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Gor Abgaryan
                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 & 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
                • Gor AbgaryanG
                  Gor Abgaryan @PeterJones
                  last edited by

                  @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
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors