Community
    • Login

    A single UDL.xml for both theme types (light and dark)?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    17 Posts 4 Posters 1.9k 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.
    • David Brigden52D
      David Brigden52 @José Luis Montero Castellanos
      last edited by

      @José-Luis-Montero-Castellanos This is ot quite the answer you are looking for, but if you can used a set of highlight colors which are readable in both light and dark themes you can set those and have the foreground/background colors be the theme default as needed. In the UDL GUI to select colors, just right click. Not perfect, but you might have something usable in both modes

      José Luis Montero CastellanosJ 1 Reply Last reply Reply Quote 1
      • José Luis Montero CastellanosJ
        José Luis Montero Castellanos @Lycan Thrope
        last edited by

        @Lycan-Thrope
        Hello, thank you for your comments throughout these days. I hope to try the installer you speak of, meanwhile, I have time to throw a pillow on the matter. By the way, I have already completed the autocomplete.xml file, it is extensive, I just hope to give it a few touches and I will send you a copy, as promised, to kill your curiosity :) .

        Lycan ThropeL 1 Reply Last reply Reply Quote 1
        • José Luis Montero CastellanosJ
          José Luis Montero Castellanos @David Brigden52
          last edited by José Luis Montero Castellanos

          @David-Brigden52
          Thank you for your contribution.
          It is a partial solution, but good!, I have seen something of that in the coloring of the xml syntax. I’m clear about basing myself on the default theme. What I think I don’t quite understand is the right click button to select the colors in the GUI. I’m going to experiment to see what sticks to me.

          Greetings.

          David Brigden52D 1 Reply Last reply Reply Quote 0
          • David Brigden52D
            David Brigden52 @José Luis Montero Castellanos
            last edited by

            @José-Luis-Montero-Castellanos said in A single UDL.xml for both theme types (light and dark)?:

            @David-Brigden52
            What I think I don’t quite understand is the right click button to select the colors in the GUI

            Okay. I’ve gone back and looked at the UDL and it’s been updated since way back when. Using the GUI, for each section (Default, Comments, Keywords, etc to click on the Styler button to set font options including colors.

            Under the Foreground color and Background color there’s a checkbox labeled transparent. This is what’s new to me, it’s a more obvious way of doing what I learned as right-click. If you check Transparent for Background color, the background will be whatever the theme provides, so you would not end up with a dark background when you want to use a light theme or a light background when you are using a dark theme

            José Luis Montero CastellanosJ 1 Reply Last reply Reply Quote 2
            • José Luis Montero CastellanosJ
              José Luis Montero Castellanos @David Brigden52
              last edited by

              @David-Brigden52
              Hi,
              Good note, the truth is that I didn’t imagine what that checkbox was for and yes, it makes a lot of sense, I think that for the background it is better to be transparent than a solid color, which makes the text look like a patchwork quilt.

              Have a nice day.

              1 Reply Last reply Reply Quote 0
              • Lycan ThropeL
                Lycan Thrope @José Luis Montero Castellanos
                last edited by Lycan Thrope

                @José-Luis-Montero-Castellanos

                @José-Luis-Montero-Castellanos said in A single UDL.xml for both theme types (light and dark)?:

                By the way, I have already completed the autocomplete.xml file, it is extensive

                Good to hear. That’s the hardest part as far as actual collection of the information you need to create it, and the examples I gave you of the similarity of our languages should be a big help, also

                As for the colors, here’s a few screenshots of what I was talking about. Here my DarkMode Language and Dark Mode (custom by the way) are selected:
                DarkModeImplemented1.PNG

                And here, the DarkMode preference is turned off:
                DarkModeTurnedOff.PNG
                Notice all the colors are now askew in the language, because the language Dark version is still selected. Here I switch the language to the Normal or light mode:
                LightModeNormalSelected.PNG

                Notice the text coloring got darker for the light background of the Preferences non-DarkMode. Also notice that the customized UI for the margins, the eol characters (CR/LF) are still in Dark Mode, because I override the System settings so I could colorize the keywords of the language myself, and also allow users to choose their own, otherwise, I wouldn’t be able to select any colors other than the system’s choice.

                I hope this gives you some idea of what you’re looking at doing with giving a choice to users of Normal or DarkMode, because if they want to customize it, they need the option to do it…so much customization, so little time :)

                José Luis Montero CastellanosJ 1 Reply Last reply Reply Quote 2
                • José Luis Montero CastellanosJ
                  José Luis Montero Castellanos @Lycan Thrope
                  last edited by José Luis Montero Castellanos

                  @Lycan-Thrope
                  Cheers:
                  I haven’t tried that part of Settings > Preferences > Dark Mode. I’m going to experiment to get familiar with it, and review your observations, see and decide: what can I do with those options.

                  Now that I think about it:
                  Shouldn’t this dark mode option be found in Settings > Styler > Themes?

                  And what are the differences if monokai (one of the themes) (i.e.) is a dark mode?

                  Thanks.

                  Lycan ThropeL 1 Reply Last reply Reply Quote 0
                  • Lycan ThropeL
                    Lycan Thrope @José Luis Montero Castellanos
                    last edited by Lycan Thrope

                    @José-Luis-Montero-Castellanos ,

                    I haven’t tried that part of Settings > Preferences > Dark Mode. I’m going to experiment to get familiar with it, and review your observations, see and decide: what can I do with those options.

                    You do that. You may never get back to the UDL, though. There are so many options it’s dizzying. :)

                    Now that I think about it:
                    Shouldn’t this dark mode option be found in Settings > Styler > Themes?

                    Nope, it needs it’s own section, since it makes big global changes that are controlled from that menu…any fine tuning gets done in the stylers separate from the Dark Mode option. It’s much better than it was about a year ago, and one of the reasons I held off on making one as it seemed to have some shortcomings

                    And what are the differences if monokai (one of the themes) (i.e.) is a dark mode?

                    Not sure, I tested it to see what you were talking about, but, then again, I like my settings, and they are my DarkModeDefault. I know I probably shouldn’t modify the default, but I don’t see myself using the other…and seeing that dark grey background reminds me to put my DarkModeDefault in the selection box. :)

                    1 Reply Last reply Reply Quote 0
                    • PeterJonesP
                      PeterJones @José Luis Montero Castellanos
                      last edited by

                      @José-Luis-Montero-Castellanos ,

                      I’ve been thinking about the root problem since you first brought it up, and it interested me to see whether or not I could do “live recolorizing” in PythonScript. After some playing around, I was able to determine that I could write a script for the PythonScript plugin that changes the colors for each of the categories/styles in a UDL’s definition on the fly.

                      I created a script that when run will register a notification callback, so that any time you open a UDL-based file (or switch to its tab) or change the Language of the active file to a UDL, it will run the “re-colorizer” to switch from Luminosity to 1-Luminosity (so dark colors will switch to light and vice versa – basically, if you look at the luminosity slider in the color picker window, if it used to be at 25% it will swap to 75% and vice versa: colors near black and white change a lot; colors near the center of the luminosity scale barely change; and it will always stay on the same “color column”, only changing luminosity, not hue or saturation).

                      The re-colorizer will do some logic: it will check if the current UDL is in the list of dark_udls (ie, UDLs that were defined with a Dark Mode in mind), and if you are actually running in Light Mode, it will do the color swap. Similarly, if the current UDL is in light_udls, and if you are running in Dark Mode, it will do the color swap.

                      Instructions:

                      Setup PythonScript per FAQ. The script can be downloaded from my nppStuff repo and saved as RecolorUDL.py, as the instructions tell you to.

                      You then should edit RecolorUDL.py lines ~23-24, the dark_udls and light_udls lists. Make it a comma-separated list of strings, where each string is the exact name of one of your UDLs, as seen in the UDL Define Your Language Dialog or the Language menu. UDLs that are natively dark-themed should go in dark_udls list, and UDLs that are natively light-themed should go in light_udls list. If the active UDL is not in either list, then the colors won’t be changed automatically.

                      Running the script once will set up the callbacks for this run of Notepad++. But if you exit Notepad++ and restart, it will need to be run again. (It is not recommended to run this script more than once in a given run of Notepad++.)

                      If you want it to automatically start (as described in the FAQ), you can edit your user startup.py (right click on PythonScript > Scripts > startup (user)) and add:

                      import RecolorUDL
                      RecolorUDL.RecolorUDL()
                      

                      As mentioned in the FAQ, you need to make sure that PythonScript Initialisation setting is ATSTARTUP, and that your user startup.py import paths are set up appropriately.

                      José Luis Montero CastellanosJ Lycan ThropeL 2 Replies Last reply Reply Quote 3
                      • José Luis Montero CastellanosJ
                        José Luis Montero Castellanos @PeterJones
                        last edited by José Luis Montero Castellanos

                        @PeterJones
                        Good evening:

                        First of all, thank you for your time slot implementing a solution.

                        Sounds interesting, so let’s get to work! - I start downloading the files indicated and see the FAQ, and then make it functional for my UDL.

                        I do not know how long it takes to me, because I have not used the python together with notepad ++, I proceed, I will see what more I can add and then I comment.

                        Thank you.

                        1 Reply Last reply Reply Quote 1
                        • Lycan ThropeL
                          Lycan Thrope @PeterJones
                          last edited by

                          @PeterJones ,
                          Interesting, but my environment is so custom done, overriding the system defaults that it’s a mess either way. :) But it seems to work.

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